步驟:css
1. 安裝jquerynode
$ npm install jquery --save-dev
2.在webpack.config.js 添加內容jquery
+ const webpack = require("webpack");
module.exports = { entry: './index.js', output: { path: path.join(__dirname, './dist'), publicPath: '/dist/', filename: 'index.js' }, + plugins: [ new webpack.ProvidePlugin({ jQuery: 'jquery', $: 'jquery' }) ] }
3.在入口文件index.js 裏面添加內容webpack
import $ from 'jquery' ;
4.測試一下是否安裝成功,看看可否彈出'123'web
<template> <div> Hello world! </div> </template> <script> $(function () { alert(123); }); export default { }; </script> <style> </style>
1.安裝Bootstrapnpm
$ npm install --save-dev bootstrap
2.在入口文件index.js裏引入相關bootstrap
import './node_modules/bootstrap/dist/css/bootstrap.min.css'; import './node_modules/bootstrap/dist/js/bootstrap.min.js';
3.添加一段Bootstrap代碼ide
<div class="btn-group" role="group" aria-label="..."> <button type="button" class="btn btn-default">Left</button> <button type="button" class="btn btn-default">Middle</button> <button type="button" class="btn btn-default">Right</button> </div>
4.運行,查看效果 這些按鈕已經變成Bootstrap按鈕組了測試