axios控制台爆红问题Uncaught (in promise):xxx解决

博客指出axios拦截器中Promise.reject抛出的错误会打印在控制台,且每次请求需用catch捕获但又不做处理,影响体验。介绍了通过promise二次封装实现全局捕获错误统一处理,避免每次请求都用catch及控制台打印爆红的问题。

首先还原问题代码:

    err => {
        return Promise.reject(err)
    }

在axios的拦截器中有这么一句代码Promise.reject(new Error('错误内容')),用来抛出错误并打印在控制台并阻止代码往下继续运行,但是实际中我们并不想把这玩意儿打印出来:Uncaught (in promise)

并且我们在调用请求时:

axios.get('/api').then(res=>{

}).catch(err=>{
    // 处理捕获的错误err
})

我们每发一个请求都要戴上catch去捕获抛出的错误,但实际上我们并不想也并没有对这个err错误进行过啥处理,而且他还会在控制台上打印出来,强迫症就贼难受,所以我们要如何实现全局捕获它统一处理呢?下面直接上代码:

/**
 * 将axios实例再封装一层promise,将响应结果做为resolve返回出来
 * 手动调用实例的catch,抓所有axios的Promise.reject在控制台抛出的爆红
 * 所有的Promise.reject都会走这个catch,我们对错误err不做任何输出或其它处理,爆红就没了
 */
const _ajax = function (obj) {
    return new Promise((resolve) => {
        _fetch(obj)// 这里的_fetch是axios.create()创建的axios实例对象
            .then(res => {
                resolve(res)
            })
            /* eslint-disable */
            .catch(err => {
                // console.log(err)
                // reject(err)
                // console.log(err.messagae)
                // 这里对错误啥也不干,控制台就不爆红了
            })
    })
}

// 将重新配置后的axios暴露出去
export default _ajax

这样用promise二次封装包一层后,我们就不用每次请求时都在后面catch一下了,控制台的打印爆红也无辽~

请分析下面控制台报错:tps://github.com/vuejs/vue-devtools axios-interceptors.js?55ef:62 Object request.js?b775:81 检查认证信息 axios-interceptors.js?55ef:62 Object axios-interceptors.js?55ef:62 Object TabsView.vue?2dce:375 routes Array(5) TabsView.vue?2dce:375 routes Array(12) TabsView.vue?2dce:375 routes Array(5) axios-interceptors.js?55ef:62 Object :8080/#/todo:1 Uncaught (in promise) Object request.js?b775:81 检查认证信息 SideMenu.vue?950f:63 obj Object axios-interceptors.js?55ef:62 Object axios-interceptors.js?55ef:62 Object request.js?b775:81 检查认证信息 axios-interceptors.js?55ef:62 Object vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "Yes" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "No" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "createVisible" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "loading" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "handleCreateOk" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "handleCreateCancel" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "loading" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "form" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "formLayout" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "StepForms" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in render: "TypeError: Cannot read property 'length' of undefined" found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:1888 TypeError: Cannot read property 'length' of undefined at Proxy.render (Autoreposition.vue?b778:1374) at VueComponent.Vue._render (vue.runtime.esm.js?2b0e:3548) at VueComponent.updateComponent (vue.runtime.esm.js?2b0e:4066) at Watcher.get (vue.runtime.esm.js?2b0e:4479) at new Watcher (vue.runtime.esm.js?2b0e:4468) at mountComponent (vue.runtime.esm.js?2b0e:4073) at VueComponent.Vue.$mount (vue.runtime.esm.js?2b0e:8415) at init (vue.runtime.esm.js?2b0e:3118) at merged (vue.runtime.esm.js?2b0e:3301) at createComponent (vue.runtime.esm.js?2b0e:5978) logError @ vue.runtime.esm.js?2b0e:1888 Autoreposition.vue?bbec:763 新建 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "Yes" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "No" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "createVisible" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "loading" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "handleCreateOk" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "handleCreateCancel" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "loading" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "form" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "formLayout" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "StepForms" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in render: "TypeError: Cannot read property 'length' of undefined" found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:1888 TypeError: Cannot read property 'length' of undefined at Proxy.render (Autoreposition.vue?b778:1374) at VueComponent.Vue._render (vue.runtime.esm.js?2b0e:3548) at VueComponent.updateComponent (vue.runtime.esm.js?2b0e:4066) at Watcher.get (vue.runtime.esm.js?2b0e:4479) at Watcher.run (vue.runtime.esm.js?2b0e:4554) at flushSchedulerQueue (vue.runtime.esm.js?2b0e:4310) at Array.eval (vue.runtime.esm.js?2b0e:1980) at flushCallbacks (vue.runtime.esm.js?2b0e:1906) logError @ vue.runtime.esm.js?2b0e:1888 axios-interceptors.js?55ef:62 Object axios-interceptors.js?55ef:62 Object :8080/api/surroundinga/erc/listPurposeCode/J2A:1 Failed to load resource: the server responded with a status of 404 (Not Found) :8080/api/surroundinga/erc/listEquipmentType/J2A:1 Failed to load resource: the server responded with a status of 404 (Not Found) 2axios-interceptors.js?55ef:103 onRejected :8080/api/surroundinga/erc/listChangeCode/J2A:1 Failed to load resource: the server responded with a status of 404 (Not Found) axios-interceptors.js?55ef:103 onRejected 3createError.js?2d83:16 Uncaught (in promise) Error: Request failed with status code 404 at createError (createError.js?2d83:16) at settle (settle.js?467f:17) at XMLHttpRequest.handleLoad (xhr.js?b50d:62) axios-interceptors.js?55ef:62 Object vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "Yes" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "No" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "createVisible" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "loading" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "handleCreateOk" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "handleCreateCancel" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "loading" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "form" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "formLayout" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "StepForms" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in render: "TypeError: Cannot read property 'length' of undefined" found in ---> <Process> at src/pages/mlcs/NewApplication/Mlcs/Autoreposition.vue <PageToggleTransition> at src/components/transition/PageToggleTransition.vue <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <AdminLayout> at src/layouts/AdminLayout.vue <TabsView> at src/layouts/tabs/TabsView.vue <ALocaleProvider> <LocaleReceiver> <AConfigProvider> <App> at src/App.vue <Root> warn @ vue.runtime.esm.js?2b0e:619 vue.runtime.esm.js?2b0e:1888 TypeError: Cannot read property 'length' of undefined at Proxy.render (Autoreposition.vue?b778:1374) at VueComponent.Vue._render (vue.runtime.esm.js?2b0e:3548) at VueComponent.updateComponent (vue.runtime.esm.js?2b0e:4066) at Watcher.get (vue.runtime.esm.js?2b0e:4479) at Watcher.run (vue.runtime.esm.js?2b0e:4554) at flushSchedulerQueue (vue.runtime.esm.js?2b0e:4310) at Array.eval (vue.runtime.esm.js?2b0e:1980) at flushCallbacks (vue.runtime.esm.js?2b0e:1906)
11-02
"axios.js:557 Uncaught (in promise)" 错误通常发生在使用 Axios 进行网络请求时,具体来说,这个错误可能是因为在处理响应或Promise链上出现了异常。错误信息没有直接指出问题所在,但可能是以下几种情况之一: 1. **网络错误**:请求可能失败了,比如超时、服务器错误或网络连接问题。检查网络连接,如果服务器有问题,联系服务提供商。 2. **参数或配置错误**:确认传递给 Axios 的参数和配置是否正确。比如 URL、headers、数据格式等。 3. **解析或处理响应错误**:在 `.then` 或 `.catch` 中,代码可能没有正确处理响应数据。检查这部分的逻辑,看是否有预期之外的错误处理。 4. ** Axios 实例的错误处理**:确保你在实例化 Axios 时没有设置错误处理器(默认会抛出异常),如果没有处理,可以添加 `.catch` 方法捕获错误。 5. **版本兼容性问题**:检查使用的 Axios 版本是否与你的项目其他依赖存在冲突,尝试更新到最新版本或回退至已知稳定的版本。 为了解决这个问题,你可以采取以下步骤: - **检查错误堆栈**:查看完整的错误堆栈,它可能会提供更详细的错误信息。 - **添加日志**:在关键点添加日志记录,跟踪请求和响应的细节。 - **重现问题**:尝试在本地环境重现错误,以便更好地定位。 - **使用try/catch**:在可能出错的地方添加错误处理代码,例如: ```javascript axios.get('/api/data') .then(response => { // 处理成功响应 }) .catch(error => { console.error('axios error:', error); }); ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值