Home >Web Front-end >Bootstrap Tutorial >How to introduce bootstrap in vue
If you want to know more about bootstrap, you can click: bootstrap tutorial
1. Introduction of jquery
Steps:
1. Install jquery
$ npm install jquery --save-dev
2. In webpack .config.js Add content
+ 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. Add content to the entry file index.js
import $ from 'jquery' ;
4. Test whether the installation is successful and see if '123' can pop up
<template> <div> Hello world! </div> </template> <script> $(function () { alert(123); }); export default { }; </script> <style> </style>
2. Introduce bootstrap
1. Install Bootstrap
$ npm install --save-dev bootstrap
2. Introduce it in the entry file index.js Related
import './node_modules/bootstrap/dist/css/bootstrap.min.css'; import './node_modules/bootstrap/dist/js/bootstrap.min.js';
3. Add a piece of Bootstrap code
<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. View the effect
The above is the detailed content of How to introduce bootstrap in vue. For more information, please follow other related articles on the PHP Chinese website!