Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Velpro187
uni-app
提交
2bb3a826
U
uni-app
项目概览
Velpro187
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2bb3a826
编写于
7月 30, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(h5): onBackPress
上级
f1174f1c
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
13 addition
and
25 deletion
+13
-25
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+1
-3
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+7
-18
packages/uni-h5/src/framework/components/page/pageHead.tsx
packages/uni-h5/src/framework/components/page/pageHead.tsx
+1
-1
packages/uni-h5/src/service/api/route/navigateBack.ts
packages/uni-h5/src/service/api/route/navigateBack.ts
+4
-3
未找到文件。
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
2bb3a826
...
...
@@ -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
(()
=>
{
});
}
}
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
2bb3a826
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(() => {
});
}
}
...
...
packages/uni-h5/src/framework/components/page/pageHead.tsx
浏览文件 @
2bb3a826
...
...
@@ -250,7 +250,7 @@ function onPageHeadBackButton() {
}
else
{
;(
uni
.
navigateBack
as
Function
)({
from
:
'
backbutton
'
,
})
})
.
catch
(()
=>
{})
}
}
...
...
packages/uni-h5/src/service/api/route/navigateBack.ts
浏览文件 @
2bb3a826
...
...
@@ -10,15 +10,16 @@ import { ON_BACK_PRESS } from '@dcloudio/uni-shared'
export
const
navigateBack
=
defineAsyncApi
<
API_TYPE_NAVIGATE_BACK
>
(
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
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录