I created my first Vue app and I have a problem with the router. I have 3 components first 2 works perfectly but 3 doesn't. Here is 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 don't know what I'm doing wrong. I tried to use Register.vue in login rout and it worked. What I'm doing wrong? Thanks in advance for the help!
If it matters I run sever by npm run dev.
/account/registerdirectly by entering url to browser?