Vuejs2 VueRouter在非历史模式下省略#前面的正斜杠

Vuejs2 VueRouter在非历史模式下省略#前面的正斜杠,vuejs2,laravel-5.4,vue-router,Vuejs2,Laravel 5.4,Vue Router,我正试图在我的Laravel应用程序中使用VueRouter2.2.1,出于某种原因,我的URL(虽然工作)以一种奇怪的方式显示了#符号 http://myapp.dev/admin#/ 而不是 http://myapp.dev/admin/#/ 正如我通常期望的那样 这是我的VueRouter配置 const Router = new VueRouter({ routes: [ { path: '/', compone

我正试图在我的Laravel应用程序中使用VueRouter
2.2.1
,出于某种原因,我的URL(虽然工作)以一种奇怪的方式显示了#符号

http://myapp.dev/admin#/
而不是

http://myapp.dev/admin/#/
正如我通常期望的那样

这是我的VueRouter配置

const Router = new VueRouter({
    routes: [
        {
            path: '/',
            component: App,
            children: [
                {
                    path: 'dashboard',
                    name: 'dashboard',
                    component: Dashboard
                }
            ]
        }
    ]
});
在PHP方面,我只是为应用程序的
/admin
部分定义了一个全包路由


像这样,我有什么做错了吗?它正在工作,但它只是让我有点不舒服,它只是浮在那里。

您必须启用历史模式,如上所述,我在您的vue路由器配置中看不到这一点

const Router = new VueRouter({
    mode: 'history',
    routes: [
        {
            path: '/',
            component: App,
            children: [
                {
                    path: 'dashboard',
                    name: 'dashboard',
                    component: Dashboard
                }
            ]
        }
    ]
});

您必须在服务器端执行此操作,只需将路由重定向到以
'/'

正如在拉威尔:

Route::get('{all?}', function() {
    return view('index');
})->where(['all' => '^/admin\/$'])->name('catchall');
现在只需访问
/admin/#/

我必须设置历史记录模式吗?我宁愿不使用它,我以前使用过Angular,它的工作方式就像我所说的
/#/
,然后不管您的URI是什么,在VueJS中这是不可能的?
Route::get('{all?}', function() {
    return view('index');
})->where(['all' => '^/admin\/$'])->name('catchall');