Echart表实现自适应
<template>
<div id="lineAndBarChart" :class="className" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts'
export default {
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '220%'
},
autoResize: {
type: Boolean,
default: true
},
},
data() {
return {
chart: null,
data1:
datacity:
}
},
watch: {
data1(newData, oldData){
this.$nextTick(() => {
this.initChart()
})
},
datacity(newData, oldData){
this.$nextTick(() => {
this.initChart()
})
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
this.getList()
}