Commit 731c868978fb4d8ebd5c06d535ce0c5536dda446
1 parent
75d3172d
跳转优化
Showing
3 changed files
with
14 additions
and
3 deletions
subPackages/treePage/addTree.vue
| ... | ... | @@ -317,7 +317,6 @@ export default { |
| 317 | 317 | // this.$refs.form && this.$refs.form.immediateValidate(true, rules) |
| 318 | 318 | }, |
| 319 | 319 | onLoad(options) { |
| 320 | - | |
| 321 | 320 | this.formData.road = options.roadId |
| 322 | 321 | |
| 323 | 322 | }, |
| ... | ... | @@ -407,7 +406,10 @@ export default { |
| 407 | 406 | if (res.code == '200') { |
| 408 | 407 | uni.showToast({title: "新增成功", icon: "none"}); |
| 409 | 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 | 415 | } else { | ... | ... |
subPackages/treePage/editTree.vue
| ... | ... | @@ -30,6 +30,12 @@ export default { |
| 30 | 30 | onLoad(options){ |
| 31 | 31 | this.id = options.id |
| 32 | 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 | 39 | // this.treeDetailQuery() |
| 34 | 40 | }, |
| 35 | 41 | methods:{ | ... | ... |
subPackages/treePage/editTreeIfo.vue
| ... | ... | @@ -428,7 +428,10 @@ export default { |
| 428 | 428 | if (res.code == '200') { |
| 429 | 429 | uni.showToast({title: "修改成功", icon: "none"}); |
| 430 | 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 | 437 | } else { | ... | ... |