您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

vue3中addRoute路由变化但页面未更新如何解决

2025/3/11 10:21:21发布15次查看
解决办法,每次addroute时 深复制组件对象
import time from "../views/time"function copyobj(obj) { if (typeof obj == "object") { if (array.isarray(obj)) { let arr = []; for (let item of obj) { arr.push(object.assign(copyobj(item))); } return arr; } else if (obj == null) { return null; } else { let obj1 = {}; for (let index in obj) { obj1[index] = copyobj((obj[index])); } return obj1; } } else if (typeof obj == "function") { return object.assign(obj); } else if (typeof obj == undefined) { return undefined; } else { return obj; }}window.pushtime = function () { let t = new date().gettime(); let path = `/time/${t}`; time = copyobj(time) this.$router.addroute({ path, name: path, component: time, }); this.$router.push({ path, });}
以上就是vue3中addroute路由变化但页面未更新如何解决的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product