Reputation: 1
my single page application is not working and after running my app there is blank page logging in the console that path is required in the router configuration.
this is my main.js
import Vue from 'vue' import VueRouter from 'vue-router';import App from './App.vue'import {routes} from './routes.js'; Vue.use(VueRouter); const router=new VueRouter({routes});new Vue({el: '#app',router:router , render: h => h(App)})
this is my routs.js
import User from './components/User/User.vue';import Home from'./components/Home.vue';import App from './App.vue';export const routes=[{ path:'', component: Home },{ Path:'/user', component:User}];
this is my app temlate
<template> <div class="container">
<div class="row">
<div class="col-lg-12 col-md-6 col-xs-12 col-sm-8 col-sm-offset-2 col-md-offset-3"><h1 class="text-center mt-3">Routing</h1><hr><router-view></router-view>
</div>
</div>
other components are also set like this.
I expected that the app page will be rendered.
Upvotes: 0
Views: 2835
Reputation: 380
It would be easier to get to grips with your code if you put some line returns in there.
I can't see your closing </template>
tag. That would be an issue.
In your routes.js, try: routes=[{ path:'/', component: Home }{ path:'/user', component:User }]
- note the path for home is '/'
Hope that helps
Upvotes: 1
Reputation: 1079
In routes.js, For the second route you are adding path as Path, You have to give 'path'. P should be lowercase like this.
routes: [{ path: "/", component: Home }, { path: "/user", component: Hello }]
Upvotes: 1