Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yangkaifeng
uni-app
提交
c26c15de
U
uni-app
项目概览
yangkaifeng
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c26c15de
编写于
4月 23, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: showModal
上级
516ff43a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
21 deletion
+20
-21
packages/uni-core/src/helpers/dom.ts
packages/uni-core/src/helpers/dom.ts
+2
-4
packages/uni-h5/dist/uni-h5.esm.js
packages/uni-h5/dist/uni-h5.esm.js
+8
-10
packages/uni-h5/src/service/api/ui/popup/modal.tsx
packages/uni-h5/src/service/api/ui/popup/modal.tsx
+3
-3
packages/uni-h5/src/service/api/ui/popup/showModal.ts
packages/uni-h5/src/service/api/ui/popup/showModal.ts
+7
-4
未找到文件。
packages/uni-core/src/helpers/dom.ts
浏览文件 @
c26c15de
import
{
withModifiers
}
from
'
vue
'
import
safeAreaInsets
from
'
safe-area-insets
'
export
const
onTouchmovePrevent
=
/*#__PURE__*/
withModifiers
(()
=>
{},
[
'
prevent
'
,
])
export
const
onTouchmoveStop
=
/*#__PURE__*/
withModifiers
(()
=>
{},
[
'
stop
'
])
export
const
onEventPrevent
=
/*#__PURE__*/
withModifiers
(()
=>
{},
[
'
prevent
'
])
export
const
onEventStop
=
/*#__PURE__*/
withModifiers
(()
=>
{},
[
'
stop
'
])
export
function
getWindowOffset
()
{
const
style
=
document
.
documentElement
.
style
...
...
packages/uni-h5/dist/uni-h5.esm.js
浏览文件 @
c26c15de
...
...
@@ -623,11 +623,9 @@ var safeAreaInsets = {
offChange
};
var
out
=
safeAreaInsets
;
const
onTouchmovePrevent
=
/* @__PURE__ */
withModifiers
(()
=>
{
},
[
"
prevent
"
]);
const
onTouchmoveStop
=
/* @__PURE__ */
withModifiers
(()
=>
{
const
onEventPrevent
=
/* @__PURE__ */
withModifiers
(()
=>
{
},
[
"
prevent
"
]);
const
onEventStop
=
/* @__PURE__ */
withModifiers
(()
=>
{
},
[
"
stop
"
]);
function
getWindowOffset
()
{
const
style2
=
document
.
documentElement
.
style
;
...
...
@@ -12848,7 +12846,7 @@ var modal = /* @__PURE__ */ defineComponent({
name
:
"
uni-fade
"
},
{
default
:
()
=>
[
withDirectives
(
createVNode
(
"
uni-modal
"
,
{
onTouchmove
:
on
Touchmove
Prevent
onTouchmove
:
on
Event
Prevent
},
[
VNODE_MASK
,
createVNode
(
"
div
"
,
{
class
:
"
uni-modal
"
},
[
title
&&
createVNode
(
"
div
"
,
{
...
...
@@ -12858,9 +12856,9 @@ var modal = /* @__PURE__ */ defineComponent({
textContent
:
title
},
null
,
8
,
[
"
textContent
"
])]),
createVNode
(
"
div
"
,
{
class
:
"
uni-modal__bd
"
,
onTouchmove
:
onTouchmove
Stop
,
onTouchmove
Passive
:
onEvent
Stop
,
textContent
:
content
},
null
,
40
,
[
"
onTouchmove
"
,
"
textContent
"
]),
createVNode
(
"
div
"
,
{
},
null
,
40
,
[
"
onTouchmove
Passive
"
,
"
textContent
"
]),
createVNode
(
"
div
"
,
{
class
:
"
uni-modal__ft
"
},
[
showCancel
&&
createVNode
(
"
div
"
,
{
style
:
{
...
...
@@ -12891,11 +12889,11 @@ const showModal = defineAsyncApi(API_SHOW_MODAL, (args, {resolve}) => {
currentShowModalResolve
=
resolve
;
if
(
!
showModalState
)
{
showModalState
=
reactive
(
args
);
nextTick
(()
=>
createRootApp
(
modal
,
showModalState
,
onModalClose
).
mount
(
ensureRoot
(
"
u-a-m
"
)));
nextTick
(()
=>
(
createRootApp
(
modal
,
showModalState
,
onModalClose
).
mount
(
ensureRoot
(
"
u-a-m
"
)),
nextTick
(()
=>
showModalState
.
visible
=
true
)));
}
else
{
extend
(
showModalState
,
args
);
showModalState
.
visible
=
true
;
}
showModalState
.
visible
=
true
;
},
ShowModalProtocol
,
ShowModalOptions
);
const
loadFontFace
=
defineAsyncApi
(
API_LOAD_FONT_FACE
,
({
family
,
source
,
desc
},
{
resolve
,
reject
})
=>
{
addFont
(
family
,
source
,
desc
).
then
(()
=>
{
...
...
packages/uni-h5/src/service/api/ui/popup/modal.tsx
浏览文件 @
c26c15de
import
{
on
TouchmovePrevent
,
onTouchmove
Stop
}
from
'
@dcloudio/uni-core
'
import
{
on
EventPrevent
,
onEvent
Stop
}
from
'
@dcloudio/uni-core
'
import
{
Transition
,
defineComponent
,
ExtractPropTypes
}
from
'
vue
'
import
{
usePopup
,
VNODE_MASK
}
from
'
./utils
'
...
...
@@ -51,7 +51,7 @@ export default /*#__PURE__*/ defineComponent({
const
{
title
,
content
,
showCancel
,
confirmText
,
confirmColor
}
=
props
return
(
<
Transition
name
=
"uni-fade"
>
<
uni
-
modal
v
-
show
=
{
visible
.
value
}
onTouchmove
=
{
on
Touchmove
Prevent
}
>
<
uni
-
modal
v
-
show
=
{
visible
.
value
}
onTouchmove
=
{
on
Event
Prevent
}
>
{
VNODE_MASK
}
<
div
class
=
"uni-modal"
>
{
title
&&
(
...
...
@@ -61,7 +61,7 @@ export default /*#__PURE__*/ defineComponent({
)
}
<
div
class
=
"uni-modal__bd"
onTouchmove
=
{
onTouchmove
Stop
}
onTouchmove
Passive
=
{
onEvent
Stop
}
v
-
text
=
{
content
}
></
div
>
<
div
class
=
"uni-modal__ft"
>
...
...
packages/uni-h5/src/service/api/ui/popup/showModal.ts
浏览文件 @
c26c15de
...
...
@@ -31,15 +31,18 @@ export const showModal = defineAsyncApi<API_TYPE_SHOW_MODAL>(
if
(
!
showModalState
)
{
showModalState
=
reactive
(
args
as
ModalProps
)
// 异步执行,避免干扰 getCurrentInstance
nextTick
(()
=>
createRootApp
(
modal
,
showModalState
,
onModalClose
).
mount
(
ensureRoot
(
'
u-a-m
'
)
nextTick
(
()
=>
(
createRootApp
(
modal
,
showModalState
,
onModalClose
).
mount
(
ensureRoot
(
'
u-a-m
'
)
),
//下一帧执行,确保首次显示时有动画效果
nextTick
(()
=>
(
showModalState
.
visible
=
true
))
)
)
}
else
{
extend
(
showModalState
,
args
)
showModalState
.
visible
=
true
}
showModalState
.
visible
=
true
},
ShowModalProtocol
,
ShowModalOptions
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录