After creating my very first Vue app, I encountered an issue with the router. While the first two components function perfectly, the third one does not seem to work as expected. Below is a snippet of my code:
index.js
import Vue from 'vue'
import Router from 'vue-router'
import Homepage from '@/components/Homepage'
import Login from '@/components/Login'
import Register from '@/components/Register'
Vue.use(Router)
export default new Router({
mode: 'history',
routes: [
{
path: '/',
name: 'Homepage',
component: Homepage
},
{
path: '/account/login',
name: 'Login',
component: Login
},
{
path: '/account/register',
name: 'Register',
compontent: Register
}
]
})
Register.vue
<template>
<div class="hello">
<h2>This is test</h2>
</div>
</template>
<script>
import Vue from 'vue'
export default {
name: 'Register',
data () {
return {
username: '',
email: '',
password: ''
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
I am stuck and unable to figure out what's causing the problem. Interestingly, using Register.vue in the login route seemed to work fine. Can someone please guide me on what mistake I might be making? Any help would be greatly appreciated!
If it helps, I am running the server by executing npm run dev
.