Answer the question
In order to leave comments, you need to log in
Why does vue duplicate index?
Such a question, I’m just starting to study vue (spa), but for some reason the App is duplicated 2 times (first screen):
and the rest of the routes work fine.
main.js:
import Vue from 'vue'
import App from './App'
import About from './components/About'
import Request from './components/Request'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const routes = [
{ path: '/', component: App },
{ path: '/about', component: About },
{ path: '/request', component: Request }
]
const router = new VueRouter({
routes
})
new Vue({
el: '#app',
template: '<App/>',
components: { App },
router
}).$mount('#app')
<template>
<div id="app">
<!-- здесь будут отображаться наши компоненты -->
<router-link to="/">Home</router-link>
<router-link to="/about">About</router-link>
<router-link to="/request">Request</router-link>
<router-view></router-view>
</div>
</template>
<script>
export default {
name: 'app',
}
</script>
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