123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <template>
- <div :class="className" :style="{height:height,width:width}">1</div>
- </template>
- <script>
- import * as echarts from 'echarts';
- require('echarts/theme/macarons') // echarts theme
- import resize from './mixins/resize'
- const animationDuration = 6000
- export default {
- mixins: [resize],
- props: {
- className: {
- type: String,
- default: 'chart'
- },
- width: {
- type: String,
- default: '100%'
- },
- height: {
- type: String,
- default: '300px'
- }
- },
- data() {
- return {
- chart: null
- }
- },
- mounted() {
- this.$nextTick(() => {
- this.initChart()
- })
- },
- beforeDestroy() {
- if (!this.chart) {
- return
- }
- this.chart.dispose()
- this.chart = null
- },
- methods: {
- initChart() {
- this.chart = echarts.init(this.$el, '消息列表')
- }
- }
- }
- </script>
|