zcc-echarts
v0.0.1
Published
自封装vue使用echarts
Downloads
3
Readme
自封装vue使用echarts
- 安装zcc-echarts库
npm install zcc-echarts --save
- 引入zcc-echarts库
全局引入
import zccEcharts from 'zcc-echarts'
Vue.use(zccEcharts)
局部引入
import echarts from "zcc-echarts/components";
components: {
echarts
}
使用
<template>
<div>
<echarts :options="options"></echarts>
<button @click="set">修改</button>
</div>
</template>
<script>
export default {
data() {
return {
options: {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar'
}]
}
}
},
methods: {
set() {
this.options.series= [{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: 'bar'
}]
}
},
};
</script>