【发布时间】:2019-09-18 18:49:46
【问题描述】:
如何将Bootstrap Vue 安装/导入/包含到我的laravel 项目中?我是 Vue 的新手,我知道如何在 Vue JS 应用程序中安装,但是如何添加它 laravel?
app.scss
// Fonts
@import url("https://fonts.googleapis.com/css?family=Nunito");
// Variables
@import "variables";
// Bootstrap
@import "~bootstrap/scss/bootstrap";
@import "node_modules/bootstrap/scss/bootstrap";
@import "node_modules/bootstrap-vue/src/index.scss";
.navbar-laravel {
background-color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}
app.js
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require("./bootstrap")
window.Vue = require("vue")
import BootstrapVue from "bootstrap-vue" //Importing
Vue.use(BootstrapVue) // Teslling Vue to use this whole application
/**
* The following block of code may be used to automatically register your
* Vue components. It will recursively scan this directory for the Vue
* components and automatically register them with their "basename".
*
* Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
*/
// const files = require.context('./', true, /\.vue$/i);
// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default));
Vue.component(
"example-component",
require("./components/ExampleComponent.vue").default
)
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
const app = new Vue({
el: "#app"
})
【问题讨论】:
-
我的问题是关于
Bootstrap-Vue,而不是Bootstrap -
抱歉误读,但我有点困惑,文档中已经说过,如何在 vue 项目中导入 vue-bootstrap?你设置了laravel应用程序吗?你看过 laravel/resources 中的 vue app.js/components 了吗?到目前为止你尝试了什么?
-
我想在这个问题之前。你应该学习(查看一些教程)如何在 laravel 应用程序中运行 vue。那么你就了解了基础知识。
-
你需要再看一遍我的问题,如果知道如何在 laravel 中导入 bootstrap-vue 请告诉我
point by point,否则你的 cmets 不相关,谢谢
标签: laravel vue.js bootstrap-vue