<template>
<div id="">
<div id="myChart" :style="{width: '300px', height: '300px'}"></div>
</div>
</template>
<script>
export default {
name: 'FuncFormsBase',
props: {},
data() {
return {msg: 'Welcome to Your Vue.js App'};
},
// 子组件转换
components: {},
// 数据引入 created
created() {
},
mounted() {
this.drawLine();
},
//点击函数事件
methods: {
drawLine () {
var echarts = require('echarts');
var myChart = echarts.init(document.getElementById('myChart'));
myChart.setOption({
title: {
text: 'ECharts 入门示例'
},
tooltip: {},
xAxis: {
data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
});
}
},
//计算事件
computed: {},
//数据监听
watch: {},
//过滤器
filters: {},
//设定自定义指令
directives: {},
}
</script>
<style lang="scss" scoped>
</style>
import Vue from 'vue'
import App from './App.vue'
import echarts from 'echarts'
Vue.prototype.$echarts = echarts
Vue.config.productionTip = false
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')