TypeError: Cannot read properties of undefined (reading 'matched')

0 阅读1分钟

一:报错信息

image.png

main.js:11 TypeError: Cannot read properties of undefined (reading 'matched')
    at render (vue-router.esm.js:320:25)
    at createFunctionalComponent (vue.runtime.esm.js:4199:30)
    at createComponent (vue.runtime.esm.js:4335:12)
    at _createElement (vue.runtime.esm.js:2836:15)
    at createElement$1 (vue.runtime.esm.js:2792:10)
    at vm._c (vue.runtime.esm.js:2567:12)
    at Proxy.render (index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/App.vue?vue&type=template&id=7ba5bd90:13:7)
    at Vue._render (vue.runtime.esm.js:2616:22)
    at VueComponent.updateComponent (vue.runtime.esm.js:3736:21)
    at Watcher.get (vue.runtime.esm.js:3330:27)

二: 报错代码

TypeError: Cannot read properties of undefined (reading 'matched')
    at render (vue-router.esm.js:320:25)
    at createFunctionalComponent (vue.runtime.esm.js:4199:30)
    at createComponent (vue.runtime.esm.js:4335:12)
    at _createElement (vue.runtime.esm.js:2836:15)
    at createElement$1 (vue.runtime.esm.js:2792:10)
    at vm._c (vue.runtime.esm.js:2567:12)
    at Proxy.render (index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/App.vue?vue&type=template&id=7ba5bd90:13:7)
    at Vue._render (vue.runtime.esm.js:2616:22)
    at VueComponent.updateComponent (vue.runtime.esm.js:3736:21)
    at Watcher.get (vue.runtime.esm.js:3330:27)

三:解决

千万不要忘记导出router,不然用不了 还会报这个错

(我是忘记了,我以为我写了,所以就没关注,结果仔细检查 才发现,没写,呜呜) image.png