为了动态生成echart图像,在render函数中生成了一个div,怎么把echart绑定在这个div上?
render (h, c) {
const dom = h('div')
const chart = ECharts.init(/* ? */)
}
?这里怎么绑定?
为了动态生成echart图像,在render函数中生成了一个div,怎么把echart绑定在这个div上?
render (h, c) {
const dom = h('div')
const chart = ECharts.init(/* ? */)
}
?这里怎么绑定?
export default {
// ...
render(h) {
return h('div', {
attrs: {
id: 'echart'
}
})
},
mounted() {
const options = {}
const el = document.getElementById('echart')
const chart = ECharts.init(/* ? */)
}
}
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
2 回答4.7k 阅读✓ 已解决
4 回答4.3k 阅读✓ 已解决
4 回答1.9k 阅读✓ 已解决
2 回答2.6k 阅读✓ 已解决
2 回答2.5k 阅读✓ 已解决
给div加个id吧,这样即能取到dom,以后如果用到多个图表,也不会重复