解决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. IntelliJ IDEA设置背景图片的方法步骤2. 如何使用Docker搭建pypi私有仓库3. 最最常用的 100 个 Java 类4. Python-openpyxl表格读取写入的案例详解5. .NET的基元类型包括什么及Unmanaged和Blittable类型详解6. python os.listdir()乱码解决方案7. Python selenium模拟网页点击爬虫交管12123违章数据8. Python的Django框架实现数据库查询(不返回QuerySet的方法)9. Java之JSP教程九大内置对象详解(中篇)10. 解决Python import .pyd 可能遇到路径的问题

网公网安备