echarts.vue
523 字节
<template>
<view>
<l-echart ref="chartRef" @finished="init"></l-echart>
</view>
</template>
<script>
import * as echarts from '@/pages_data/static/echarts.min.js'
export default {
props: {
option: {
type: Object,
require: true
}
},
// 组件能被调用必须是组件的节点已经被渲染到页面上
methods: {
async init() {
// chart 图表实例不能存在data里
const chart = await this.$refs.chartRef.init(echarts);
chart.setOption(this.option)
}
}
}
</script>
<style>
</style>