Procházet zdrojové kódy

fix(market/detail.vue): add fallback when navigateBack has no pages in stack

openhands před 3 měsíci
rodič
revize
14f0978ee4
1 změnil soubory, kde provedl 6 přidání a 1 odebrání
  1. 6 1
      cfc-frontend/pages/parent/market/detail.vue

+ 6 - 1
cfc-frontend/pages/parent/market/detail.vue

@@ -116,7 +116,12 @@ export default {
             })
             })
             uni.showToast({ title: '应用成功' })
             uni.showToast({ title: '应用成功' })
             setTimeout(() => {
             setTimeout(() => {
-              uni.navigateBack()
+              var pages = getCurrentPages()
+              if (pages.length > 1) {
+                uni.navigateBack()
+              } else {
+                uni.switchTab({ url: '/pages/index/index' })
+              }
             }, 1500)
             }, 1500)
           } catch (e) {
           } catch (e) {
             uni.showToast({ title: '应用失败', icon: 'none' })
             uni.showToast({ title: '应用失败', icon: 'none' })