欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

解決vue+router路由跳轉(zhuǎn)不起作用的一項(xiàng)原因

 更新時(shí)間:2020年07月19日 15:33:15   作者:浪漫的程序猿  
這篇文章主要介紹了解決vue+router路由跳轉(zhuǎn)不起作用的一項(xiàng)原因,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧

如下所示:

Vue.use(Router)
export default new Router({
mode:'history',
routes: [
   { path: '/', component: Login },
   { path: '/login', component: Login },
   { path: '/register',component: Register},
   {path: '/*', component: NotFound},
    ]
})

記得要寫上 mode:'history', 原因如下

補(bǔ)充知識(shí):vue-router配置后地址欄輸入跳轉(zhuǎn)不成功問(wèn)題

在起服務(wù)的js中增加 connect-history-api-fallback

const history = require('connect-history-api-fallback');
 
// 在靜態(tài)頁(yè)面之前,這一句:app.use('/static', express.static(__dirname + '/public'))之前設(shè)置history
const historyConfig = {
 index: '/index.html'
};
app.use(history(historyConfig));

以上這篇解決vue+router路由跳轉(zhuǎn)不起作用的一項(xiàng)原因就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論