Get the App
SLTechnology News&Howtos  ›  Development  › 

How to introduce Bootstrap into Vue Project

Shulou Source: shulou.com Published: 2022-06-01 04:18:28 09月22日 Update

This article is about how to introduce Bootstrap into Vue projects. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Introducing Bootstrap into Vue projects

Sometimes Bootstrap is introduced according to the requirements in the vue project, and Bootstrap depends on jQuery, so a series of errors may occur when using npm installation

1. Install jQuery

Npm install jquery

2. Install Bootstrap

Npm install bootstrap@3

In the above two steps, you can also specify the version number in the package.json configuration file, and then run npm install

After the installation, the project will not run. Although both of them have been successfully installed, the error "Bootstrap's JavaScript requires jQuery npm" will still be reported. To solve this problem, you can introduce it in the main.js entry file as follows:

Import $from 'jquery'window.jQuery = $require (' bootstrap')

Next, in order to be able to use the style of Bootstrap, you can introduce bootstrap.css in the portal file. This is the same way to introduce Element UI.

Import 'bootstrap/dist/css/bootstrap.min.css' Thank you for your reading! This is the end of the article on "how to introduce Bootstrap into the Vue project". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Project file entry content more article good practical successful next middle finger finished article method style version see knowledge or Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi OPPO Reno Linux NVidia MySQL