【axios】引入
npm install axios -S
main.js
import axios from 'axios'
Vue.prototype.$axios = axios;
【babel-polyfill】引入
为解决es6语法在IE中兼容性问题 IE9+
npm install babel-polyfill
在main.js中配置
在main.js中配置
【cookie&&session】引入
cookies
npm install vue-cookies -S
main.js
import VueCookies from 'vue-cookies'
Vue.use(VueCookies);
使用
this.$cookies.set("key",value); //存cookies
this.$cookies.get("key"); //获取cookies
session
npm install vue-session
在main.js中配置
import VueSession from 'vue-session'
Vue.use(VueSession)
使用
this.$session.set("key",value); //存session
this.$session.get("key"); //获取session
【Echarts】引入
npm install echarts -S
main.js
import echarts from 'echarts'
Vue.prototype.$echarts = echarts
Echarts5.0引入方式
import * as echarts from 'echarts';
// 按需引入
import * as echarts from 'echarts/lib/echarts';
在使用的页面引入
var echarts = require("echarts/lib/echarts");
require("echarts/lib/chart/bar");
require("echarts/lib/chart/radar");
require("echarts/lib/component/tooltip");
require("echarts/lib/component/title");
【es6-promise】引入
解决promise在ie浏览器的兼容性问题 IE9+
npm install es6-promise --save-dev
在main.js中配置
import promise from 'es6-promise';
promise.polyfill();
【JQuery】引入
npm install jquery -S
配置webpack.base.conf文件
const webpack = require("webpack");
//在最后
module.exports = {
//添加
plugins:[
new webpack.optimize.CommonsChunkPlugin('common.js'),
new webpack.ProvidePlugin({
jQuery: "jquery",
$: "jquery"
})
]
}
在main.js中配置
import $ from 'jquery'
sass引入
"sass-loader": "7.3.1",
"style-loader": "^2.0.0",
"node-sass":'4.0.0'
build/webpack.base.conf/
module:{
rules:[
{
test: /.sass$/,
loaders: ['style', 'css', 'sass']
},
]
}