美文网首页
引入 bootstrap

引入 bootstrap

作者: SingleDiego | 来源:发表于2019-07-27 20:52 被阅读0次

首先安装 bootstrap 包,我选择的版本是 4.1.1:

npm i bootstrap@4.1.1

package.jsondependencies 字段会包含 bootstrap:

"bootstrap": {
      "version": "4.1.1",
      "resolved": "https://registry.npm.taobao.org/bootstrap/download/bootstrap-4.1.1.tgz",
      "integrity": "sha1-OuyFAA+mGQhdqNLkmD39Z88hFMs="
    },

index.js 中引用相关 css:

import 'bootstrap/dist/css/bootstrap.css';

如需要使用 Bootstrap 的 javascript,由于依赖关系,需要先引入 jQuery,再去引入 Bootstrap 的 javascript。

安装 jQuery:

npm i jquery

引入相关 js:

import 'jquery';
import 'bootstrap/dist/js/bootstrap.bundle.min.js';

相关文章

网友评论

      本文标题:引入 bootstrap

      本文链接:https://www.haomeiwen.com/subject/ticyrctx.html