一:项目环境搭建
vue create 项目名称 (建立使用淘宝镜像)
选择Manually 手动
vue 2
勾选Babel,Router,vuex,CssPre,Linter,
history模式:no
Sass
Eslint+Standard config
Lint on Save
In dedicated config files
二: 引入element-ui(按需引入)
vue add element
Y
Import on demand
zh-CN
三:下载引入echarts,将echarts加入到原型上
npm i -S echarts 一定加-S,项目上线后dependencies才找的到
注意要用v-charts库的话这里安装echarts 4.0.1版本,因为v-charts好久没更新
在main.js中
import Echarts from 'echarts'
Vue.prototype.$echarts = Echarts
这样就不用每个组件引入echarts时就不用import了,直接使用$echarts就可以实现。