diff --git a/packages/uni-h5/dist/uni-h5.cjs.js b/packages/uni-h5/dist/uni-h5.cjs.js index aac6bf28785bc95ad6a1f0b41ec26a144622b3ac..e4adfd7a58c8ba2d567ba1b0f2a8c6a1bd4de630 100644 --- a/packages/uni-h5/dist/uni-h5.cjs.js +++ b/packages/uni-h5/dist/uni-h5.cjs.js @@ -373,9 +373,6 @@ function initBridge(subscribeNamespace) { emitter.off(`${subscribeNamespace}.${event}`, callback); }, subscribeHandler(event, args, pageId) { - if (process.env.NODE_ENV !== "production") { - console.log(uniShared.formatLog(subscribeNamespace, "subscribeHandler", pageId, event, args)); - } emitter.emit(`${subscribeNamespace}.${event}`, args, pageId); } }; @@ -10587,6 +10584,7 @@ function onPageHeadBackButton() { } else { uni.navigateBack({ from: "backbutton" + }).catch(() => { }); } } diff --git a/packages/uni-h5/dist/uni-h5.es.js b/packages/uni-h5/dist/uni-h5.es.js index 3fee9853093befa45cd7f18ffd4ecf4bc7c3a552..02b0841f7c0050ffdd16e8c6d32eb1640afcc9a1 100644 --- a/packages/uni-h5/dist/uni-h5.es.js +++ b/packages/uni-h5/dist/uni-h5.es.js @@ -1,5 +1,5 @@ import { isFunction, extend, isString, hyphenate, isPlainObject, isArray, hasOwn, isObject, capitalize, toRawType, makeMap as makeMap$1, isPromise, invokeArrayFns as invokeArrayFns$1 } from "@vue/shared"; -import { once, formatLog, passive, initCustomDataset, invokeArrayFns, normalizeTarget, isBuiltInComponent, ON_RESIZE, ON_APP_ENTER_FOREGROUND, ON_APP_ENTER_BACKGROUND, ON_SHOW, ON_HIDE, ON_PAGE_SCROLL, ON_REACH_BOTTOM, EventChannel, SCHEME_RE, DATA_RE, getCustomDataset, ON_ERROR, callOptions, PRIMARY_COLOR, removeLeadingSlash, getLen, debounce, NAVBAR_HEIGHT, parseQuery, ON_UNLOAD, ON_REACH_BOTTOM_DISTANCE, decodedQuery, WEB_INVOKE_APPSERVICE, ON_WEB_INVOKE_APP_SERVICE, updateElementStyle, ON_BACK_PRESS, parseUrl, addFont, scrollTo, RESPONSIVE_MIN_WIDTH, formatDateTime, ON_PULL_DOWN_REFRESH } from "@dcloudio/uni-shared"; +import { once, passive, initCustomDataset, invokeArrayFns, normalizeTarget, isBuiltInComponent, ON_RESIZE, ON_APP_ENTER_FOREGROUND, ON_APP_ENTER_BACKGROUND, ON_SHOW, ON_HIDE, ON_PAGE_SCROLL, ON_REACH_BOTTOM, EventChannel, SCHEME_RE, DATA_RE, getCustomDataset, ON_ERROR, callOptions, PRIMARY_COLOR, removeLeadingSlash, getLen, debounce, NAVBAR_HEIGHT, parseQuery, ON_UNLOAD, ON_REACH_BOTTOM_DISTANCE, decodedQuery, WEB_INVOKE_APPSERVICE, ON_WEB_INVOKE_APP_SERVICE, updateElementStyle, ON_BACK_PRESS, parseUrl, addFont, scrollTo, RESPONSIVE_MIN_WIDTH, formatDateTime, ON_PULL_DOWN_REFRESH } from "@dcloudio/uni-shared"; import { openBlock, createBlock, mergeProps, createVNode, toDisplayString, withModifiers, getCurrentInstance, defineComponent, ref, provide, computed, watch, onUnmounted, inject, onBeforeUnmount, reactive, onActivated, onMounted, nextTick, onBeforeMount, withDirectives, vShow, shallowRef, watchEffect, isVNode, Fragment, markRaw, createTextVNode, injectHook, onBeforeActivate, onBeforeDeactivate, renderList, onDeactivated, createApp, Transition, withCtx, KeepAlive, resolveDynamicComponent, renderSlot } from "vue"; import { initVueI18n, LOCALE_EN, LOCALE_ES, LOCALE_FR, LOCALE_ZH_HANS, LOCALE_ZH_HANT } from "@dcloudio/uni-i18n"; import { useRoute, createRouter, createWebHistory, createWebHashHistory, useRouter, isNavigationFailure, RouterView } from "vue-router"; @@ -462,9 +462,6 @@ function initBridge(subscribeNamespace) { emitter2.off(`${subscribeNamespace}.${event}`, callback); }, subscribeHandler(event, args, pageId) { - if (process.env.NODE_ENV !== "production") { - console.log(formatLog(subscribeNamespace, "subscribeHandler", pageId, event, args)); - } emitter2.emit(`${subscribeNamespace}.${event}`, args, pageId); } }; @@ -486,15 +483,9 @@ function subscribeViewMethod(pageId) { UniViewJSBridge.subscribe(normalizeViewMethodName(pageId, INVOKE_VIEW_API), onInvokeViewMethod); } function unsubscribeViewMethod(pageId) { - if (process.env.NODE_ENV !== "production") { - console.log(formatLog("unsubscribeViewMethod", pageId, INVOKE_VIEW_API)); - } UniViewJSBridge.unsubscribe(normalizeViewMethodName(pageId, INVOKE_VIEW_API)); Object.keys(viewMethods).forEach((name) => { if (name.indexOf(pageId + ".") === 0) { - if (process.env.NODE_ENV !== "production") { - console.log(formatLog("unsubscribeViewMethod", name)); - } delete viewMethods[name]; } }); @@ -523,9 +514,6 @@ function onInvokeViewMethod({ handler(args, publish); } else { publish({}); - if (process.env.NODE_ENV !== "production") { - console.error(formatLog("invokeViewMethod", name, "not register")); - } } } const ViewJSBridge = /* @__PURE__ */ extend(initBridge("service"), { @@ -3045,8 +3033,8 @@ class MapContext { getCenterLocation(options) { operateMapWrap(this.id, this.pageId, "getCenterLocation", options); } - moveToLocation() { - operateMapWrap(this.id, this.pageId, "moveToLocation"); + moveToLocation(options) { + operateMapWrap(this.id, this.pageId, "moveToLocation", options); } getScale(options) { operateMapWrap(this.id, this.pageId, "getScale", options); @@ -17516,15 +17504,15 @@ const chooseLocation = /* @__PURE__ */ defineAsyncApi(API_CHOOSE_LOCATION, (args reject("cancel"); } }, ChooseLocationProtocol); -const navigateBack = /* @__PURE__ */ defineAsyncApi(API_NAVIGATE_BACK, ({ delta }, { resolve, reject }) => { +const navigateBack = /* @__PURE__ */ defineAsyncApi(API_NAVIGATE_BACK, (args, { resolve, reject }) => { let canBack = true; - if (invokeHook(ON_BACK_PRESS) === true) { + if (invokeHook(ON_BACK_PRESS, { from: args.from }) === true) { canBack = false; } if (!canBack) { return reject(ON_BACK_PRESS); } - getApp().$router.go(-delta); + getApp().$router.go(-args.delta); return resolve(); }, NavigateBackProtocol, NavigateBackOptions); function navigate({ type, url, events }, __id__) { @@ -20809,6 +20797,7 @@ function onPageHeadBackButton() { } else { uni.navigateBack({ from: "backbutton" + }).catch(() => { }); } } diff --git a/packages/uni-h5/src/framework/components/page/pageHead.tsx b/packages/uni-h5/src/framework/components/page/pageHead.tsx index 75173aa662a75b3f4b13593e995508401fd84ca6..b12965da58fbca9db1a359d5cd065aab1c3feeb6 100644 --- a/packages/uni-h5/src/framework/components/page/pageHead.tsx +++ b/packages/uni-h5/src/framework/components/page/pageHead.tsx @@ -250,7 +250,7 @@ function onPageHeadBackButton() { } else { ;(uni.navigateBack as Function)({ from: 'backbutton', - }) + }).catch(() => {}) } } diff --git a/packages/uni-h5/src/service/api/route/navigateBack.ts b/packages/uni-h5/src/service/api/route/navigateBack.ts index 0bea99a32c1c752260f31c7ae346a1360337dbb4..2484ad8eba89a8d8996514c5c2bdc4f0a0186c89 100644 --- a/packages/uni-h5/src/service/api/route/navigateBack.ts +++ b/packages/uni-h5/src/service/api/route/navigateBack.ts @@ -10,15 +10,16 @@ import { ON_BACK_PRESS } from '@dcloudio/uni-shared' export const navigateBack = defineAsyncApi( API_NAVIGATE_BACK, - ({ delta }, { resolve, reject }) => { + (args, { resolve, reject }) => { let canBack = true - if (invokeHook(ON_BACK_PRESS) === true) { + if (invokeHook(ON_BACK_PRESS, { from: (args as any).from }) === true) { canBack = false } if (!canBack) { return reject(ON_BACK_PRESS) } - getApp().$router.go(-delta!) + + getApp().$router.go(-args.delta!) return resolve() }, NavigateBackProtocol,