在列表页点详情通过 this.router.push({path:‘’,query: }) 跳转传参
goToPage(row) {
this.$router.push({
path: "/employeeManagement/employeeDetail",
query: { id: row.userId, creationTime: row.creationTime },
});
},
详情页在created里通过this. $ route.query.id 获取id,错误写法:通过Number( this.$route.query.id),转数子,导致精度丢失,所以id变了,正确写法就是不加Number()
我那个id有十几位长大概5481231213337,后端要int型我就用Number转了一下,结果变成了5481231213004,
created() {
if (this.$route.query.id) {
this.userId = this.$route.query.id;
this.creationTime = this.$route.query.creationTime ? this.$public.getDate(this.$route.query.creationTime) : ''
this.getAgentStaffDetails({ userId: this.userId })
this.getDistributionData()
}
},