drake035
drake035

Reputation: 2887

Route isn't valid (Vue.js)

The route for my Login.vue component works (see here) whereas the route for my SignUp.vue component doesn't (see here). Why?

Full source code here

Router config file (src/router/index.js):

import Vue from 'vue';
import Home from '../components/Home.vue';
import SignUp from '../components/SignUp.vue';
import Login from '../components/Login.vue';

import Router from 'vue-router';
Vue.use(Router);

export default new Router({
  routes: [
  {
    path: '/',
    component: Home
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: 'signup',
    component: SignUp
  },
  ]
});

Root HTML file (index.html):

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>timelog</title>
  </head>
  <body>
    <div id="app">
      <router-link to="/"><h1>Timelog</h1></router-link>
      <router-view></router-view>
    </div>
    <script src="dist/build.js"></script>
  </body>
</html>

Upvotes: 0

Views: 136

Answers (1)

The Guy with The Hat
The Guy with The Hat

Reputation: 11132

Change path: 'signup', to path: '/signup',

Upvotes: 2

Related Questions