From 4520767f024db05556a478929c0a933ff5c200e9 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Sat, 18 May 2019 19:10:33 +0800 Subject: [PATCH] fix(h5): onTabItemTap --- src/core/service/api/route.js | 8 ++++++-- src/core/service/plugins/util.js | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/core/service/api/route.js b/src/core/service/api/route.js index 380e97d32..4f44348aa 100644 --- a/src/core/service/api/route.js +++ b/src/core/service/api/route.js @@ -5,7 +5,8 @@ import { function onAppRoute (type, { url, delta, - from = 'navigateBack' + from = 'navigateBack', + detail } = {}) { const router = getApp().$router switch (type) { @@ -45,7 +46,10 @@ function onAppRoute (type, { case 'switchTab': router.replace({ type, - path: url + path: url, + params: { + detail + } }) break } diff --git a/src/core/service/plugins/util.js b/src/core/service/plugins/util.js index 705d2de50..55819da95 100644 --- a/src/core/service/plugins/util.js +++ b/src/core/service/plugins/util.js @@ -20,7 +20,13 @@ export function callPageHook (vm, hook, ...params) { vm.$mp.query = params[0] UniServiceJSBridge.publishHandler('onPageLoad', vm, vm.$page.id) } - if (hook === 'onShow') { + if (hook === 'onShow') { + if ( + vm.$route.meta.isTabBar && + vm.$route.params.detail + ) { + UniServiceJSBridge.emit('onTabItemTap', vm.$route.params.detail) + } UniServiceJSBridge.publishHandler('onPageShow', vm, vm.$page.id) } } -- GitLab