Commit 731c868978fb4d8ebd5c06d535ce0c5536dda446

Authored by 刘淇
1 parent 75d3172d

跳转优化

subPackages/treePage/addTree.vue
@@ -317,7 +317,6 @@ export default { @@ -317,7 +317,6 @@ export default {
317 // this.$refs.form && this.$refs.form.immediateValidate(true, rules) 317 // this.$refs.form && this.$refs.form.immediateValidate(true, rules)
318 }, 318 },
319 onLoad(options) { 319 onLoad(options) {
320 -  
321 this.formData.road = options.roadId 320 this.formData.road = options.roadId
322 321
323 }, 322 },
@@ -407,7 +406,10 @@ export default { @@ -407,7 +406,10 @@ export default {
407 if (res.code == '200') { 406 if (res.code == '200') {
408 uni.showToast({title: "新增成功", icon: "none"}); 407 uni.showToast({title: "新增成功", icon: "none"});
409 // uni.$tui.href(`/subPackages/treePage/treeRecord?roadId=${this.formData.road}`) 408 // uni.$tui.href(`/subPackages/treePage/treeRecord?roadId=${this.formData.road}`)
410 - uni.$tui.href(`/subPackages/treePage/treeFiles`) 409 + // uni.$tui.href(`/subPackages/treePage/treeFiles`)
  410 + uni.redirectTo({
  411 + url: '/subPackages/treePage/treeFiles' // 目标页面路径
  412 + });
411 } 413 }
412 }) 414 })
413 } else { 415 } else {
subPackages/treePage/editTree.vue
@@ -30,6 +30,12 @@ export default { @@ -30,6 +30,12 @@ export default {
30 onLoad(options){ 30 onLoad(options){
31 this.id = options.id 31 this.id = options.id
32 console.log( this.id ) 32 console.log( this.id )
  33 + const pages = getCurrentPages(); // 获取当前页面栈
  34 + // 只保留当前页面(移除所有历史页面)
  35 + if (pages.length > 1) {
  36 + // 小程序页面栈是数组,通过 splice 保留最后一个元素(当前页面)
  37 + pages.splice(0, pages.length - 1);
  38 + }
33 // this.treeDetailQuery() 39 // this.treeDetailQuery()
34 }, 40 },
35 methods:{ 41 methods:{
subPackages/treePage/editTreeIfo.vue
@@ -428,7 +428,10 @@ export default { @@ -428,7 +428,10 @@ export default {
428 if (res.code == '200') { 428 if (res.code == '200') {
429 uni.showToast({title: "修改成功", icon: "none"}); 429 uni.showToast({title: "修改成功", icon: "none"});
430 // uni.$tui.href(`/subPackages/treePage/treeRecord?roadId=${this.formData.road}`) 430 // uni.$tui.href(`/subPackages/treePage/treeRecord?roadId=${this.formData.road}`)
431 - uni.$tui.href(`/subPackages/treePage/treeFiles`) 431 + // uni.$tui.href(`/subPackages/treePage/treeFiles`)
  432 + uni.redirectTo({
  433 + url: '/subPackages/treePage/treeFiles' // 目标页面路径
  434 + });
432 } 435 }
433 }) 436 })
434 } else { 437 } else {