Most examples I see out there, has <router-view> set up inside the main App.vue component but mine isn't like that.
I have another component called <content> in App. Inside <content>, I have various other components like <skills>, <projects> etc.
Right now, I'm toggling each of them using a v-show but now, I want to use routes.
Here's the template of my App.vue
<div id="app">
<img id="photo" src="../public/assets/IMG_3187.jpg">
<Content msg="Divyanth Jayaraj"/>
<site-footer></site-footer>
</div>
Inside the Content.vue, the template looks like this. Notice the commented tags.
<div class="content">
<h1>{{ msg }}</h1>
<p>
UI/UX Consultant
</p>
<navbar @select='navigate($event)'></navbar>
<router-view></router-view>
<!-- <intro v-show='this.navSelect == "Introduction"'></intro>
<skills v-show='this.navSelect == "Skills"'></skills>
<education v-show='this.navSelect == "Education"'></education>
<projects v-show='this.navSelect == "Projects"'></projects>
<faq v-show='this.navSelect == "FAQ"'></faq> -->
</div>
The <router-view> is supposed to render each of my components but aren't. Just for reference, I set up vue-router after I built most of the project.
Just for reference, here's how I have my router set up.
This is routes.js
import Introduction from './components/introduction/introduction'
import Skills from './components/skills/skills'
import Projects from './components/projects/projects'
import Education from './components/education/education'
import FAQ from './components/FAQ/faq'
const routes = [
{ path: '/', redirect: '/Introduction'},
{ path: '/Introduction', name: 'Introduction', component: Introduction},
{ path: '/Skills', name: 'Skills', component: Skills},
{ path: '/Projects', name: 'Projects', component: Projects},
{ path: '/Education', name: 'Education', component: Education},
{ path: '/FAQ', name: 'FAQ', component: FAQ}
]
This is main.js
import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router'
import Routes from './routes.js'
Vue.use(VueRouter)
Vue.config.productionTip = false
const router = new VueRouter({
routes: Routes
})
new Vue({
router,
render: h => h(App)
}).$mount('#app')
This is my App.vue although this might not be relevant
import Content from './components/content.vue'
import Footer from './components/site-footer.vue'
export default {
name: 'app',
components: {
Content,
'site-footer' : Footer
}
}
What am I doing wrong? Right now, there's nothing rendering inside <router-view>. I'm not getting any errors either.
export default routesinroutes.js