Home >Web Front-end >JS Tutorial >Detailed explanation of steps to use bootstrap in vue-cli project

Detailed explanation of steps to use bootstrap in vue-cli project

PHPz
PHPzOriginal
2018-04-27 14:24:586312browse

This time I will bring you a detailed explanation of the steps for using bootstrap in the vue-cli project. What are the precautions for using bootstrap in the vue-cli project? The following is a practical case, let's take a look.

【Related video recommendation: Bootstrap tutorial

Install plug-in

npm install jquery --save
npm install bootstrap --save
npm install popper.js --save

Configure webpack.base.conf.js

//在顶部添加
const webpack = require('webpack')
//在module.exports = {}末尾添加下面代码
module.exports = {
...
plugins: [
  new webpack.ProvidePlugin({
   $: "jquery",
   jQuery: "jquery"
  })
 ]
}

Add in main.js

import $ from 'jquery'
import 'bootstrap'

Test jquery

//在vue文件中添加测试代码
<script>
$(function () {
 alert('234')
})
export default {
 name: 'App'
}
</script>

Test bootstrap

<template>
<p class="container">
  <p class="row">
    <p class="col-md-6">
      <button class="btn btn-primary">测试按钮</button>
    </p>
  </p>
</p>
</template>

I believe you have mastered the method after reading the case in this article, more exciting Please pay attention to other related articles on php Chinese website!

Recommended reading:

JS Gets the User’s Current Location

##How AngularJs Prevents XSS Attacks

The above is the detailed content of Detailed explanation of steps to use bootstrap in vue-cli project. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more