【发布时间】:2018-04-14 18:03:42
【问题描述】:
我已经安装了带有节点的 vue-router。
这是我的项目地址http://localhost/UserApp/public。
我使用的两条 vue 路由是/home & /about
所以当我点击主路线时。它会将我重定向到http://localhost/home
但它应该是http://localhost/UserApp/public/home。
所以当我重新加载页面时。它抛出object not found 错误。因为没有http://localhost/home 这样的路由。
我该如何解决这个问题?
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>
【问题讨论】:
标签: php laravel laravel-5 vue-router