1
ノードにvue-routerがインストールされています。 これは私のプロジェクトのURLですhttp://localhost/UserApp/public
です。Vue-routerが正しく動作していません
私が使用した2つのルートルートは、/home
& ですので、私はホームルートをクリックします。私は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>