Answer the question
In order to leave comments, you need to log in
Why doesn't router-view work?
Hello, started learning Vue.js and ran into a problem while using vue-router and router-view.
When rendering the application, an error appears in the console:
Error in render: "TypeError: Cannot read property 'matched' of undefined"
found in
---> <App> at src/App.vue
<Root>
import Vue from 'vue'
import App from '@/App.vue'
import router from '@/router'
Vue.config.productionTip = false
new Vue({
router,
render: h => h(App)
}).$mount('#app')
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const routes = [
{ path: '/', component: () => import('@/views/Home.vue') },
{ path: '/tickets', component: () => import('@/views/Tickets.vue') },
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
<template>
<div id="app">
<h2>Vue App</h2>
<router-view></router-view>
</div>
</template>
<template>
<div>
<h2>Home page</h2>
<router-link to="/tickets">Todos</router-link>
</div>
</template>
<template>
<div>
<h2>List of tickets</h2>
<router-link to="/">Home</router-link>
</div>
</template>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question