Error in created hook: “TypeError: _api_teacher__WEBPACK_IMPORTED_MODULE_0__.XX is not a function
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.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文件名' 匹配
按照上述的对应关系,修改即可正确运行。
更多推荐
已为社区贡献1条内容
所有评论(0)