腳手架搭建的vue項目裡引入jquery和bootstrap

來源:互聯網
上載者:User

標籤:als   重構   樣式   外掛程式   page   解決方案   str   pager   require   

引入jquery:

1.在cmd輸入:npm install jquery,斷行符號,等待..

2.在webpack.base.conf.js裡進行如下操作:

3.在webpack.prod.conf.js裡進行如下操作:

4.在入口檔案裡引入:

不知道是不是jquery版本的問題,在重構以前寫的頁面時,通過在.vue檔案裡引入js的方式將寫好的js引入(該js檔案裡用了jquery外掛程式),部分功能有問題

引入bootstrap

參照網上的方式進行了實踐,生效了。

主要在設定檔裡添加了兩個設定檔,這個兩個檔案一定要放在一起

1.bootstrap.config.js檔案:

module.exports = {

// Default for the style loading
styleLoader: require(‘extract-text-webpack-plugin‘).extract(‘style-loader‘, ‘css-loader!postcss-loader!less-loader‘),

scripts: {
‘transition‘: true,
‘alert‘: true,
‘button‘: true,
‘carousel‘: true,
‘collapse‘: true,
‘dropdown‘: true,
‘modal‘: true,
‘tooltip‘: true,
‘popover‘: true,
‘scrollspy‘: true,
‘tab‘: true,
‘affix‘: true
},
styles: {
"mixins": true,

"normalize": true,
"print": true,

"scaffolding": true,
"type": true,
"code": true,
"grid": true,
"tables": true,
"forms": true,
"buttons": true,

"component-animations": true,
"glyphicons": true,
"dropdowns": true,
"button-groups": true,
"input-groups": true,
"navs": true,
"navbar": true,
"breadcrumbs": true,
"pagination": true,
"pager": true,
"labels": true,
"badges": true,
"jumbotron": true,
"thumbnails": true,
"alerts": true,
"progress-bars": true,
"media": true,
"list-group": true,
"panels": true,
"wells": true,
"close": true,

"modals": true,
"tooltip": true,
"popovers": true,
"carousel": true,

"utilities": true,
"responsive-utilities": true
}
};

2.bootstrap.strap.config.less檔案(據說空的也行,沒試過):

@font-size-base: 24px;
@btn-default-color: #444;
@btn-default-bg: #eee;

3.在入口檔案通過import ‘/path/bootstrap.min.js‘的方式引入;

4.bootstrap樣式可以採取上述方式引入或者在index.html裡引入;

5.其他外掛程式也可通過import方式引入,但部分外掛程式可能會出現問題,解決方案自行google

腳手架搭建的vue項目裡引入jquery和bootstrap

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.