问答详情
源自:4-11 axios的进一步封装(五)

按照你弄得封装五,报错

      if (res.code === 200) {

            Toast("删除成功");

            this.showEdit = false;

            this.getlist();

     }

vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in v-on handler (Promise/async): "TypeError: Cannot read property 'code' of undefined"


found in


---> <VanContactEdit>

       <VanPopup>

         <ContactList> at src/views/ContactListdemo.vue

           <App> at src/App.vue

             <Root>

warn @ vue.runtime.esm.js?2b0e:619

logError @ vue.runtime.esm.js?2b0e:1884

globalHandleError @ vue.runtime.esm.js?2b0e:1879

handleError @ vue.runtime.esm.js?2b0e:1839

(anonymous) @ vue.runtime.esm.js?2b0e:1856

Promise.catch (async)

invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1856

invoker @ vue.runtime.esm.js?2b0e:2179

invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1854

Vue.$emit @ vue.runtime.esm.js?2b0e:3882

(anonymous) @ index.js?3b16:87

Promise.then (async)

onDelete @ index.js?3b16:86

emit @ functional.js?ba31:39

onClick @ index.js?b650:46

invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1854

invoker @ vue.runtime.esm.js?2b0e:2179

original._wrapper @ vue.runtime.esm.js?2b0e:6911

vue.runtime.esm.js?2b0e:1888 TypeError: Cannot read property 'code' of undefined

    at VueComponent._callee3$ (ContactListdemo.vue?de04:105)

    at tryCatch (runtime.js?96cf:45)

    at Generator.invoke [as _invoke] (runtime.js?96cf:271)

    at Generator.prototype.<computed> [as next] (runtime.js?96cf:97)

    at asyncGeneratorStep (asyncToGenerator.js?89ba:5)

    at _next (asyncToGenerator.js?89ba:27)


提问者:粉条雨顺 2020-02-26 16:19

个回答

  • qq_慕田峪6247735
    2020-05-10 17:52:09

    自己多检查下吧,字母大小写,命名啥的 getlist要大写,驼峰命名