在项目中使用新增和编辑功能模块的时候,接口的测试均没问题,但是始终报错。
我一开始以为是Axios的配置路径的问题,又重新更换了Axios的版本,包括网上常见的引入错误,均没办法处理
PS:好多人的文章真的解决不了问题
当然我也是给大家提供一个参考方法, 万一你的问题和我一样呢?
BUG截图
详细的BUG信息
[Vue warn]: Error in v-on handler: "Error: Provided config url is not valid"
found in
---> <ElButton> at packages/button/src/button.vue
<ElDialog> at packages/dialog/src/component.vue
<User> at src/views/User.vue
<ElMain> at packages/main/src/main.vue
<ElContainer> at packages/container/src/main.vue... (1 recursive calls)
<Home> at src/views/Manage.vue
<App> at src/App.vue
<Root>
Error: Provided config url is not valid
at Axios.request (Axios.js:40:1)
at VueComponent.wrap [as request] (bind.js:9:1)
at VueComponent.save (User.vue:159:1)
at invokeWithErrorHandling (vue.runtime.esm.js:3017:1)
at VueComponent.invoker (vue.runtime.esm.js:1815:1)
at invokeWithErrorHandling (vue.runtime.esm.js:3017:1)
at Vue.$emit (vue.runtime.esm.js:3716:1)
at VueComponent.handleClick (element-ui.common.js:9465:1)
at invokeWithErrorHandling (vue.runtime.esm.js:3017:1)
at HTMLButtonElement.invoker (vue.runtime.esm.js:1815:1)
logError @ vue.runtime.esm.js:3049
globalHandleError @ vue.runtime.esm.js:3041
handleError @ vue.runtime.esm.js:3008
invokeWithErrorHandling @ vue.runtime.esm.js:3024
invoker @ vue.runtime.esm.js:1815
invokeWithErrorHandling @ vue.runtime.esm.js:3017
Vue.$emit @ vue.runtime.esm.js:3716
handleClick @ element-ui.common.js:9465
invokeWithErrorHandling @ vue.runtime.esm.js:3017
invoker @ vue.runtime.esm.js:1815
original_1._wrapper @ vue.runtime.esm.js:7473
最后发现在Vue页面中,this.request多加了一个()导致路径错误!唉,愚蠢
附上错误信息部分源码,供参考
如果这篇文章帮助到您了,请考虑给我一个点赞!