twitter-bootstrap – 将引导程序添加到Vue CLI项目
|
我是Vue和webpack的新手,我很难搞清楚如何导入东西.
我通过vue init创建了一个新的Vue项目我添加了bootstrap 4 with yarn add bootstrap@4.0.0-alpha.6 在main.js中我尝试导入bootstrap和jquery: import Vue from 'vue'; import jQuery from 'jquery'; import bootstrap from 'bootstrap'; import App from './App'; import router from './router'; 但我得到:
window.jQuery = window.$= $;不起作用 最后,我在哪里以及如何加载Sass以便整个应用程序都可以使用它? 解决方法
我遇到了同样的问题,这是我最终的结果,但是我没有使用Bootstrap alpha,因为beta已经发布了.
>安装Bootstrap及其依赖项,jQuery和Popper.js: npm install bootstrap@4.0.0-beta popper.js jquery –save-dev 插件:[ 从’vue’导入Vue <template>
<div id="app">
<img src="./assets/logo.png">
<router-view></router-view>
</div>
</template>
<script>
export default {
name: 'app'
}
</script>
<style>
#app {
font-family: 'Avenir',Helvetica,Arial,sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
@import'~bootstrap/dist/css/bootstrap.css'
</style>
>从CLI运行您的Vue应用程序 npm开始
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
