amis
amis copied to clipboard
自定义组件时,使用chart组件的onChartMount事件option为undefined
描述问题:
在开发自定义组件时,基于chart基础组件开发。在调用chart组件的onChartMount事件和chartRef钩子方法时,其中的chart对象执行getOption方法时,返回undefined。但是我在config中进行了配置。
截图或视频:
如何复现(请务必完整填写下面内容):
-
你是如何使用 amis 的? npm
-
amis 版本是什么?请先在最新 beta 版本测试问题是否存在 v5.5.0
-
粘贴有问题的完整
amis schema
代码:
class MyRenderer extends React.Component {
constructor(props) {
super(props)
}
render() {
const { render } = this.props
return render('chart', {
type: 'chart',
onChartMount: (chart, echarts) => {
chart.getOption() // undefined
},
chartRef: (chart) => {
chart.getOption() // undefined
},
config: {
legend: {},
xAxis: {
type: 'category',
},
yAxis: {
type: 'value'
},
series: [
{
type: 'line',
name: 'value'
}
]
}
})
}
}
- 操作步骤