Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'result')

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘result‘)

        如题所示问题,耽误三天寻找bug,终于在我睡意朦胧之际发现了一道光,发现 await 出现的三个点:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘result‘)

        于是打开 findAllCategory()这个函数 对应的js文件:发现

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘result‘)

        没错,问题就在 promise 函数,没有返回值,自然后面就没有res啦,而且这里提示了 await 对次表达式没有影响,就应该判断出 findAllCategory() 此函数是不是没有返回Promise对象。

        总之,小心使得万年船,大意失荆州。成败在于细节!!!与君共勉吧!!!

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。