vue.runtime.esm.js:587 [Vue warn]: Error in created hook: "TypeError: _api_teacher__WEBPACK_IMPORTED_MODULE_0__.getTeacherById is not a function"

found in

---> <Form> at src\views\teacher\form.vue
       <AppMain> at src\views\layout\components\AppMain.vue
         <Layout> at src\views\layout\Layout.vue
           <App> at src\App.vue
             <Root>
warn @ vue.runtime.esm.js:587
logError @ vue.runtime.esm.js:1733


vue.runtime.esm.js:1737 TypeError: _api_teacher__WEBPACK_IMPORTED_MODULE_0__.getTeacherById is not a function
    at VueComponent.getTeacher (form.vue?a25b:94)
    at VueComponent.init (form.vue?a25b:63)
    at VueComponent.created (form.vue?a25b:56)
    at callHook (vue.runtime.esm.js:2917)
    at VueComponent.Vue._init (vue.runtime.esm.js:4626)
    at new VueComponent (vue.runtime.esm.js:4794)
    at createComponentInstanceForVnode (vue.runtime.esm.js:4306)
    at init (vue.runtime.esm.js:4127)
    at createComponent (vue.runtime.esm.js:5604)
    at createElm (vue.runtime.esm.js:5551)

我出现的原因时在使用Vue时export导出问题。

出现此种问题,可以检查以下export和import导入是否匹配。

export function  函数名(){}    import  *  as  xxx  from '@/api/js文件名'  匹配


export default  {

      函数名(){}

  import   xxx  from '@/api/js文件名'     匹配

按照上述的对应关系,修改即可正确运行。

 

Logo

前往低代码交流专区

更多推荐