Vuejs using VUE-CLI to introduce bootstrap

Source: Internet
Author: User

  Preface: for just into the vuejs of the team in the small white, many are vague, JS operation Dom node thoughts linger, still can't freely switch between the two.

The way to solve it:

To introduce bootstrap in Vue, you need to follow the steps below.

1, introduced jquery 2, introduced bootstrap read this article, should be able to build the environment, using VUE-CLI for project creation, you can refer to the article: http://blog.csdn.net/wild46cat/article/details/76360229

1, through the NPM View module name versions to view the current version of the module, installation can also choose version installation. Example: cnpm install [email protected]--save-dev

2, installation Parameters--save and--save-dev difference is--save-dev installed in the development environment (more Baidu "NPM")

3. Use the command npm install jquery--save-dev (or cnpm install jquery--save-dev) to introduce jquery.

4, in Webpack.base.conf.js (if it is the development [Dev] environment in webpack.dev.conf.js; two files are in the Bulid directory; Please note that I was in the operation of the wrong file, half a day did not get the right; ), add the following:

var webpack = require (' Webpack ')// and plugins: [  New  Webpack. Provideplugin ({    "jquery",    "jquery"  })],

5. Add content to Main.js

Import $ from ' jquery '

6, install bootstrap, use command cnpm install bootstrap--save-dev

7. After successful installation, you can see the bootstrap module in the Package.json folder. At this point, you need to add the following in Main.js:

Import ' bootstrap/dist/css/bootstrap.min.css' bootstrap/dist/js/bootstrap.min '

8, after the addition is completed, restart the program, CNPM run Dev (the process of restarting may appear as an error: Follow the error prompts, you need to install Axios popper.js)

9, test jquery, and Boostrap installation is successful

PostScript:

Combined with official documents, entered the conditional rendering, accidentally found that the style is too ugly, so think about how to introduce bootstrap, look good, so Baidu, found the article, but also encountered some problems, feel these problems are relatively easy to appear, so the record an essay.

If you are a PHP programmer, you will find node project development and Phpcomposer development is almost the same, is said to be PHP learning NPM ^_^

Vuejs using VUE-CLI to introduce bootstrap

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.