Home > Web Front-end > Bootstrap Tutorial > How to introduce bootstrap into vue

How to introduce bootstrap into vue

爱喝马黛茶的安东尼
Release: 2019-07-13 11:25:17
Original
4678 people have browsed it

How to introduce bootstrap into vue

1. Introduction of jquery

Steps:

1. Install jquery

$ npm install jquery --save-dev
Copy after login

2. Add content to webpack.config.js

+ 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'
        })
    ]
}
Copy after login

3. Add content to the entry file index.js

import $ from 'jquery' ;
Copy after login

Related recommendations: "bootstrap Getting Started Tutorial

4. Test whether the installation is successful and see if '123' pops up

<template>
  <div>
   Hello world!
  </div>
</template>
<script>
$(function () {  
    alert(123);  
 }); 
export default {
  
};
</script>
<style>
</style>
Copy after login

2. Introduce Bootstrap

1. Installation Bootstrap

$ npm install --save-dev bootstrap
Copy after login

2. Introduce the relevant

import &#39;./node_modules/bootstrap/dist/css/bootstrap.min.css&#39;;
import &#39;./node_modules/bootstrap/dist/js/bootstrap.min.js&#39;;
Copy after login

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>
Copy after login

4. Run and check the effect. These buttons have become Bootstrap button group.

How to introduce bootstrap into vue

The above is the detailed content of How to introduce bootstrap into vue. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template