vue能用bootstrap嗎

angryTom
發布: 2019-07-29 09:36:32
原創
6406 人瀏覽過

vue能用bootstrap嗎

如果你想了解更多關於bootstrap的知識,可以點選:bootstrap教學

一、引入jquery

#步驟:

1、安裝jquery

$ npm install jquery --save-dev
登入後複製

2、在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'
        })
    ]
}
登入後複製

##3、在入口檔index.js 裡面加內容

import $ from 'jquery' ;
登入後複製

4、測試是否安裝成功,看看能否彈出'123'# #

<template>
  <div>
   Hello world!
  </div>
</template>

<script>
$(function () {  
    alert(123);  
 }); 
export default {
};
</script>
<style>
</style>
登入後複製

二、引入Bootstrap

#1、安裝Bootstrap

$ npm install --save-dev bootstrap
登入後複製

# 2.在入口檔index.js裡引入相關

import &#39;./node_modules/bootstrap/dist/css/bootstrap.min.css&#39;;
import &#39;./node_modules/bootstrap/dist/js/bootstrap.min.js&#39;;
登入後複製

3、新增一段Bootstrap程式碼

<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>
登入後複製
4.運行,查看效果 這些按鈕變成Bootstrap按鈕群組了

#

以上是vue能用bootstrap嗎的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
作者最新文章
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!