There are two main ways in which Vue introduces Bootstrap
Method One: Inintroduced in Main.js
Some of the pre-set CSS styles for HTML, body may not be valid in bootstrap imported by this method.
First, the introduction of jQuery
In the current project directory (that is , Package.json), run the command cnpm install jquery--save-dev If you run an error, run cnpm install jquery (cnpm and NPM will be able to install jquery in this project.
Then modify the webpack.base.conf.js ( under the build file ) Two places:
1: Join
var webpack=require (' Webpack ');
2 join in the Module.exports
plugins:[ new webpack.optimize.CommonsChunkPlugin (' Common.js '), new Webpack. Provideplugin ({ "jquery", "jquery" })]
Finally , add the import $ Form ' jquery' to main.jsto complete the introduction of jquery
Ii. introduction of bootstrap.css files:
Modify webpack.base.conf.js
resolve:{Extensions: ['. js ', '. Vue ', '. JSON '], alias: { ' vue$ ': ' Vue/dist/vue.esm.js ', ' @ ' : Resolve (' src '), ' Bootstrap ': Resolve (' src/assets/bootstrap ')
Import introduced in Main.js
Import ' bootstrap/js/bootstrap.min.js 'import' bootstrap/css/bootstrap.min.css '
Method Two: Inintroduced in index.html
It is generally recommended to use this method to introduce bootstrap.
When introducing bootstrap in the index.html file, be aware that the response is not implemented when you add the <meta> tag to implement the response, and when the tag is not present, the phone mode may appear.
<meta name= "Viewport" content= "Width=device-width, User-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0 "><meta http-equiv=" x-ua-compatible "content=" Ie=edge ">
(1) Local references:
The bootstrap file to be loaded in the static directory is first delegated
And then introduce it in the index.html.
The directory path is the path to the location you have placed.
(2) Remote introduction:
Direct loading of remote bootstrap files
Vue's two ways of importing bootstrap and jquery