FupingQiu / okrsw

0 stars 0 forks source link

Failed to resolve async component default: TypeError: Cannot read property 'call' of undefined #15

Open FupingQiu opened 5 years ago

FupingQiu commented 5 years ago

vue-router] Failed to resolve async component default: TypeError: Cannot read property 'call' of undefined warn @ app.js:sourcemap:43120 (anonymous) @ app.js:sourcemap:44883 (anonymous) @ app.js:sourcemap:44953 Promise rejected (async) (anonymous) @ app.js:sourcemap:44900 (anonymous) @ app.js:sourcemap:44921 (anonymous) @ app.js:sourcemap:44921 flatMapComponents @ app.js:sourcemap:44920 (anonymous) @ app.js:sourcemap:44856 iterator @ app.js:sourcemap:45063 step @ app.js:sourcemap:44837 step @ app.js:sourcemap:44841 runQueue @ app.js:sourcemap:44845 confirmTransition @ app.js:sourcemap:45092 transitionTo @ app.js:sourcemap:44994 init @ app.js:sourcemap:45645 beforeCreate @ app.js:sourcemap:43657 invokeWithErrorHandling @ app.js:sourcemap:47646 callHook @ app.js:sourcemap:49997 Vue._init @ app.js:sourcemap:50775 Vue @ app.js:sourcemap:50855 ./resources/js/app.js @ app.js:sourcemap:58986 webpack_require @ app.js:sourcemap:64 0 @ app.js:sourcemap:59278 webpack_require @ app.js:sourcemap:64 (anonymous) @ app.js:sourcemap:196 (anonymous) @ app.js:sourcemap:199 app.js:sourcemap:43120 [vue-router] uncaught error during route navigation:

FupingQiu commented 5 years ago

提示说resolve async component 失败。 根据一步一步排除,定位到“import ... from ...”这个有异常,好像是不能异步import

<style>
</style>

<template>
    <div id="app-layout"> Layout Vue
      <navigation></navigation>
      <router-view></router-view>
<!--      <login-modal></login-modal>
      <register-modal></register-modal>-->
    </div>
</template>

<script>
    import Navigation from '../components/global/Navigation';
//  import LoginModal from '../components/global/LoginModal.vue';
//  import RegisterModal from '../components/global/RegisterModal.vue';

    export default {
        components: {
//            Navigation
//          LoginModal
//          RegisterModal
        },
        created(){
            //this.$store.dispatch( 'loadCafes' );
            this.$store.dispatch( 'getAuthUser' );
        }
    }
</script>
FupingQiu commented 5 years ago

继续定位,发现是Navigation.vue中的 import 出现问题。

的 样式都会引起错误