解決vue+router路由跳轉(zhuǎn)不起作用的一項原因
如下所示:
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配置后地址欄輸入跳轉(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)不起作用的一項原因就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. JavaScript Reduce使用詳解2. python基于tkinter點擊按鈕實現(xiàn)圖片的切換3. python之cur.fetchall與cur.fetchone提取數(shù)據(jù)并統(tǒng)計處理操作4. Python查找算法之分塊查找算法的實現(xiàn)5. 深入了解JAVA 軟引用6. python實現(xiàn)讀取類別頻數(shù)數(shù)據(jù)畫水平條形圖案例7. Xml簡介_動力節(jié)點Java學院整理8. .NET 中配置從xml轉(zhuǎn)向json方法示例詳解9. 解決AJAX返回狀態(tài)200沒有調(diào)用success的問題10. JSP之表單提交get和post的區(qū)別詳解及實例
