jeudi 2 novembre 2017

Vue-router not working properly

I have installed vue-router with node. This is my project url http://localhost/UserApp/public.

And the two vue routes i used is /home & /about So when i click on the home routes. it redirects me to http://localhost/home but it should be http://localhost/UserApp/public/home. So when i reload the page. it throws object not found Error. As there is no route such as http://localhost/home. How do i solve the problem?

app.js

import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  { path: '/home', component: Home },
  { path: '/about', component: About }
]

const router = new VueRouter({
   mode : 'history',
   routes // short for `routes: routes`
})

web.php

Route::get('/{name}',function(){
    return redirect('/');
})->where('name','[A-Za-z]+');

Myheader.vue

<router-link to="/home" class="navbar-item">Home</router-link>
<router-link to="/about" class="navbar-item">About</router-link>



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2yobyr2
via IFTTT

Aucun commentaire:

Enregistrer un commentaire