2017-04-26 68 views
0

VUE路由器的URL顯示爲的 '#' 在我的網址是不正確的,當我用快遞

本地主機:3000/指數# /儀表板

但不

本地主機:3000/指數/# /儀表板

這是一種有線。

這是我的快遞代碼。

app.get('/index', function (req, res) { 
    const html = fs.readFileSync('index.html', 'utf-8'); 
    res.send(html); 
}); 

而我的vue路由器代碼。

{ 
    name: 'dashboard', 
    path: '/dashboard', 
    component: require('../views/dashboard.vue') 
} 

回答

0

嘗試在VueRouter

const router = new VueRouter({ 
    mode: 'history', 
    routes: [...] 
}) 

對於還與快遞的詳細信息設置mode: 'history',請參閱Vue Router HTML5 history mdoe

+0

如果我這樣做,將URL'本地主機:3000/dashboard' ,但我想保留路徑'/ index /' –

相關問題