3
我使用Laravel 5.3
, 我要打包所有的JavaScript文件,在文件app.js
,我需要()tether
和cropper
這樣的: :如何在laravel中打包JavaScript文件?
require('tether');// `tether` is put at the head of `Bootstrap`
require('./bootstrap');
require('cropper');
Vue.component('example', require('./components/Example.vue'));
const app = new Vue({
el: 'body'
});
然後運行gulp
,沒關係! 但在鉻broswer的控制檯,有2個錯誤:
Uncaught Error: Bootstrap tooltips require Tether
Uncaught TypeError: $image.cropper is not a function
爲什麼
PS:
bootstrap
不Bootstrap
,存在resources/assets/js
文件bootstrap.js
和Bootstrap
是Twitter的UI。
你嘗試'從「繩索」進口繫繩; window.Tether = Tether;'? – Skysplit
@Skysplit謝謝,這個問題已經解決了。另一個錯誤出現:'[Vue warn]:找不到元素:body' – zwl1619
@ zwl1619你使用的是Vue 2.0嗎? –