Browse Source

Echarts示例

master
lzh 2 years ago
parent
commit
5b2b08bd12
  1. 29
      base-ui/src/views/xiaoshou/xstj/tj.vue

29
base-ui/src/views/xiaoshou/xstj/tj.vue

@ -3,33 +3,44 @@
<div> <div>
<h3>{{ name }}</h3> <h3>{{ name }}</h3>
</div> </div>
<div id="main" style="width: 400px;height: 300px;background-color: bisque;"></div> <div ref="charta" style="height:300px;width: 100%;" />
</div> </div>
</template> </template>
<script> <script>
import * as echarts from 'echarts'; import * as echarts from 'echarts'
export default { export default {
name: 'XiaoshouXstjTj', name: 'XiaoshouXstjTj',
// components: { }, // components: { },
data() { data() {
return { return {
name: 'jkljljkjlkjlkjlj', name: 'Charts',
myChart:null myCharta: null
} }
}, },
created() { created() {
// //
this.init() // this.init()
// //
// this.getList() // this.getList()
}, },
beforeDestroy() {
if (this.myCharta) {
this.myCharta.dispose()
this.myCharta = null
}
},
mounted() {
this.$nextTick(() => {
this.initCharta()
})
},
methods: { methods: {
init() { initCharta() {
// domecharts // domecharts
this.myChart = echarts.init('main'); this.myCharta = echarts.init(this.$refs.charta)
// //
this.myChart.setOption({ this.myCharta.setOption({
title: { title: {
text: 'ECharts 入门示例' text: 'ECharts 入门示例'
}, },
@ -45,7 +56,7 @@ export default {
data: [5, 20, 36, 10, 10, 20] data: [5, 20, 36, 10, 10, 20]
} }
] ]
}); })
}, },
getList() {}, getList() {},
// //

Loading…
Cancel
Save