While attempting to integrate VueJs with VueRouter, I encountered a problem. The Home
component is displaying the log message but not the template section. Additionally, an error was thrown as shown below:
https://i.sstatic.net/2YWQL.png
Home.vue
<template>
<div class="wrap" id="app">
<h1 class="inline">Hello There</h1>
</div>
</template>
<script>
export default {
name: 'app',
data () {
return {
maps: []
}
},
mounted() {
console.log( 'Mounted Homepage' );
}
}
</script>
<style lang="scss">
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</style>
routes.js
import Vue from 'vue';
import Home from './components/Home.vue';
import NotFound from './components/NotFound.vue';
const routes = [
{ name: 'home', path: '/', components: Home },
{ path: '*', component: NotFound, meta: { title: 'Not Found' } }
];
import VueRouter from 'vue-router';
Vue.use(VueRouter);
var router = new VueRouter({
routes
})
export default router;
Main.js
import Vue from 'vue'
import NotFound from './components/NotFound.vue'
import router from './routes'
new Vue({
router,
components: {
NotFound
}
}).$mount('#rgm_app');
It seems there may be something that I overlooked. Can you help identify what it might be?