vue.js - Vue Router 为单次调用 push() 更新 URl 两次
问题描述
这个
this.$router.push({ path: '/upload'});
将浏览器 URL 更新为 ...#/upload 正常。但
this.$router.push( '/edit/file/4' );
在地址栏中短暂闪烁预期的 URL,然后将其更新为“... 4,一次到我真正以前的状态)而不是一次。
为什么 ?我怎样才能让它按我的预期工作?
我的路由器路由是
routes: [
{
path: '/',
name: 'home',
component: Home,
children:[
{
name: 'upload',
path:'upload',
component:HomeUpload
},
{
name: 'edit-file',
path: 'edit/file/:file_id',
component:HomeUpload,
props: true // or field_id prop not filled in
}
]
}
]
解决方案
因为模板有
<a @click="edit(page)" href="#">Edit</a></td>
代替
<a @click="edit(page)">Edit</a></td>
推荐阅读
- java - 使用 Axis 1.4 客户端的 NTLM 代理身份验证
- sql - 当 SQL 中的两个值具有不同的数据类型时,如何将它们与给定的十进制精度进行比较?
- r - 向量化霍夫丁的距离
- excel - Cuberankedmember 得到错误的顺序
- java - 为什么 Date 对象不代表我的 JVM 时区中的日期?
- javascript - 是否有类似 Vue.unuse 的东西可以停止使用插件?
- c# - Why does GetMember(string) return an array of MemberInfo?
- python - pandas ExcelWriter 从右到左写工作表方向
- python - 如何用 selenium 渲染长的 html 字符串
- angular - 角材料表单元格不截断长文本