laravel mix:在运行代码之前添加依赖项

时间:2017-03-01 17:27:26

标签: webpack owl-carousel laravel-5.4

我是laravel webpack的新手。这是我的app.js:

require('./bootstrap');

Vue.component('example', require('./components/Example.vue'));

const app = new Vue({
 el: '#app'
});

$(document).ready(function(){
$('.owl-carousel').owlCarousel();
});

bootstrap.js

window._ = require('lodash');

window.$ = window.jQuery = require('jquery');

require('bootstrap-sass');

require('owl.carousel');

window.Vue = require('vue');

window.axios = require('axios');

window.axios.defaults.headers.common = {
 'X-CSRF-TOKEN': window.Laravel.csrfToken,
 'X-Requested-With': 'XMLHttpRequest'
};

我在owl-carousel添加了bootstrap.js库,并在owl-carousel的最后一行启动了app.js。但是当我运行npm run watch并检查app.js时(在public/js中创建 )通过浏览器,我看到owl-carousel库位于$('.owl-carousel').owlCarousel();之后。所以猫头鹰旋转木马不会跑。我该如何处理这个问题?

0 个答案:

没有答案