I am apprehending Vue and I came across a problem. I installed vue-router
via npm
. When I call <router-view>
, no error is indicated however the site does not render on the page. If I type the links in the address bar, the contents of the components are loaded.
main.js
import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App.vue'
import {routes} from './routes'
Vue.use(VueRouter);
const router = new VueRouter({
routes
})
new Vue({
el: '#app',
router,
render: h => h(App)
})
routes.js
import Contato from './components/Contato.vue'
import Sobre from './components/Sobre.vue'
import Home from './components/Home.vue'
export const routes = [
{path : '', component: Home},
{path : '/contato', component: Contato},
{path : '/sobre', component: Sobre}
]
App.vue
<template>
<div class="" id="app">
<div class="container">
<router-view></router-view>
</div>
</div>
</template>
<script>
export default {
}
</script>
<style lang="sass">
@import "~bulma/sass/utilities/initial-variables.sass"
@import "~bulma"
</style>