解決vue+router路由跳轉(zhuǎn)不起作用的一項(xiàng)原因
如下所示:
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ù)的js中增加 connect-history-api-fallback
const history = require(’connect-history-api-fallback’); // 在靜態(tài)頁面之前,這一句:app.use(’/static’, express.static(__dirname + ’/public’))之前設(shè)置historyconst historyConfig = { index: ’/index.html’};app.use(history(historyConfig));
以上這篇解決vue+router路由跳轉(zhuǎn)不起作用的一項(xiàng)原因就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. ASP新手必備的基礎(chǔ)知識(shí)2. PHP基礎(chǔ)之生成器4——比較生成器和迭代器對象3. CentOS郵箱服務(wù)器搭建系列——SMTP服務(wù)器的構(gòu)建( Postfix )4. asp文件用什么軟件編輯5. JAVA 實(shí)現(xiàn)延遲隊(duì)列的方法6. Vue axios獲取token臨時(shí)令牌封裝案例7. js實(shí)現(xiàn)計(jì)算器功能8. JS中6個(gè)對象數(shù)組去重的方法9. 利用CSS制作3D動(dòng)畫10. 通過IEAD+Maven快速搭建SSM項(xiàng)目的過程(Spring + Spring MVC + Mybatis)

網(wǎng)公網(wǎng)安備