vue中引入jQuery和bootstrap
阿新 • • 發佈:2018-07-23
main var tst web jquery vid con oot boot
引入
$ npm install jquery bootstrap --save
jquery
1.加入webpack對象
var webpack = require(‘webpack‘);
2.在module.exports裏面引入
plugins: [ new webpack.ProvidePlugin({ $:"jquery", jQuery:"jquery", "windows.jQuery":"jquery" }) ]
3.在入口文件main.js中引入
import $ from "jquery"
全局引入jq
bootstrap
1.修改webpack.base.conf.js 文件:
alias: { ‘vue$‘: ‘vue/dist/vue.esm.js‘, ‘jquery‘: "jquery/src/jquery" },
2.在入口文件main.js中加入:
import ‘../node_modules/bootstrap/dist/css/bootstrap.min.css‘
import ‘../node_modules/bootstrap/dist/js/bootstrap.min‘
vue中引入jQuery和bootstrap