我有一個簡單的演示,我想嘗試瞭解更多關於VueJS組件。但是當我加載我的頁面時,我收到錯誤:意外的令牌導入,在這一行VueJS組件導入失敗
從'./components/GISView.vue'導入GISView;
當我刪除這個,GISView沒有定義。我使用Laravel 5.4和webpack編譯腳本。爲什麼沒有找到組件?
Main.js
import GISView from './components/GISView.vue';
window.Vue = Vue;
window.Event = new class {
constructor() {
this.Vue = new Vue();
}
fire(event, data = null) {
this.Vue.$emit(event, data);
}
listen(event, callback) {
this.Vue.$on(event, callback);
}
};
window.app = new Vue({
el: '#app',
components: {
GISView: GISView
},
data: {
},
methods: {
init: function() {
this.$broadcast('MapsApiLoaded');
}
}
});
GISView.vue
<script>
import GoogleMaps from '../mixins/GoogleMaps.js';
export default {
mixins: [GoogleMaps]
}
</script>
我真的卡住了關於這個小時,因爲剛剛通過的代碼,它應該工作,我會說。
請發佈您的webpack config的加載器部分 –