解決vue+router路由跳轉不起作用的一項原因
如下所示:
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’, 原因如下

補充知識:vue-router配置后地址欄輸入跳轉不成功問題
在起服務的js中增加 connect-history-api-fallback
const history = require(’connect-history-api-fallback’); // 在靜態頁面之前,這一句:app.use(’/static’, express.static(__dirname + ’/public’))之前設置historyconst historyConfig = { index: ’/index.html’};app.use(history(historyConfig));
以上這篇解決vue+router路由跳轉不起作用的一項原因就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持好吧啦網。
相關文章:
1. 基于android studio的layout的xml文件的創建方式2. 解決Android studio xml界面無法預覽問題3. 詳解Android studio 動態fragment的用法4. 圖文詳解vue中proto文件的函數調用5. 什么是python的自省6. Spring Boot和Thymeleaf整合結合JPA實現分頁效果(實例代碼)7. Android如何加載Base64編碼格式圖片8. 使用Android studio查看Kotlin的字節碼教程9. Vuex localStorage的具體使用10. Vue封裝一個TodoList的案例與瀏覽器本地緩存的應用實現

網公網安備