Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Velpro187
uni-app
提交
60b10804
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,发现更多精彩内容 >>
提交
60b10804
编写于
4月 27, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: withWebEvent
上级
371b4b1b
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
141 addition
and
115 deletion
+141
-115
packages/shims-vue-runtime.d.ts
packages/shims-vue-runtime.d.ts
+1
-0
packages/uni-components/src/components/label/index.tsx
packages/uni-components/src/components/label/index.tsx
+4
-4
packages/uni-components/src/helpers/useEvent.ts
packages/uni-components/src/helpers/useEvent.ts
+4
-0
packages/uni-components/src/helpers/useListeners.ts
packages/uni-components/src/helpers/useListeners.ts
+3
-5
packages/uni-components/src/helpers/useScopedAttrs.ts
packages/uni-components/src/helpers/useScopedAttrs.ts
+5
-8
packages/uni-components/src/helpers/useSubscribe.ts
packages/uni-components/src/helpers/useSubscribe.ts
+2
-1
packages/uni-components/src/index.ts
packages/uni-components/src/index.ts
+1
-1
packages/uni-core/src/view/plugin/componentInstance.ts
packages/uni-core/src/view/plugin/componentInstance.ts
+26
-27
packages/uni-h5-vue/dist/vue.runtime.esm.js
packages/uni-h5-vue/dist/vue.runtime.esm.js
+14
-2
packages/uni-h5-vue/lib/vue.runtime.esm.js
packages/uni-h5-vue/lib/vue.runtime.esm.js
+14
-2
packages/uni-h5/dist/uni-h5.esm.js
packages/uni-h5/dist/uni-h5.esm.js
+59
-58
packages/uni-h5/src/framework/components/page/page-refresh/index.ts
...ni-h5/src/framework/components/page/page-refresh/index.ts
+7
-7
packages/uni-h5/src/framework/setup/index.ts
packages/uni-h5/src/framework/setup/index.ts
+1
-0
未找到文件。
packages/shims-vue-runtime.d.ts
浏览文件 @
60b10804
...
...
@@ -15,6 +15,7 @@ declare module '@vue/runtime-core' {
__isUnload
:
boolean
__isVisible
:
boolean
__isActive
?:
boolean
// tabBar
__isPage
:
boolean
}
export
const
callSyncHook
:
(
...
...
packages/uni-components/src/components/label/index.tsx
浏览文件 @
60b10804
import
{
defineComponent
,
provide
,
getCurrentInstance
,
computed
}
from
'
vue
'
import
{
PolySymbol
}
from
'
@dcloudio/uni-core
'
import
{
withWebEvent
}
from
'
@dcloudio/uni-components
'
export
const
uniLabelKey
=
PolySymbol
(
__DEV__
?
'
uniLabel
'
:
'
ul
'
)
const
props
=
{
...
...
@@ -14,8 +15,7 @@ export default /*#__PURE__*/ defineComponent({
props
,
setup
(
props
,
{
emit
,
slots
})
{
const
instance
=
getCurrentInstance
()
!
const
vm
=
instance
.
proxy
!
const
pageId
=
vm
.
$root
!
.
$page
.
id
const
pageId
=
instance
.
root
.
proxy
!
.
$page
.
id
const
handlers
=
useProvideLabel
()
...
...
@@ -23,7 +23,7 @@ export default /*#__PURE__*/ defineComponent({
()
=>
props
.
for
||
(
slots
.
default
&&
slots
.
default
.
length
)
)
const
_onClick
=
(
$event
:
Event
)
=>
{
const
_onClick
=
withWebEvent
(
(
$event
:
Event
)
=>
{
const
EventTarget
=
$event
.
target
as
HTMLElement
let
stopPropagation
=
/^uni-
(
checkbox|radio|switch
)
-/
.
test
(
EventTarget
.
className
...
...
@@ -52,7 +52,7 @@ export default /*#__PURE__*/ defineComponent({
handler
(
$event
,
true
)
})
}
}
}
)
return
()
=>
(
<
uni
-
label
class
=
{
{
'
uni-label-pointer
'
:
pointer
}
}
onClick
=
{
_onClick
}
>
...
...
packages/uni-components/src/helpers/useEvent.ts
浏览文件 @
60b10804
...
...
@@ -4,6 +4,10 @@ import { normalizeTarget } from '@dcloudio/uni-shared'
type
EventDetail
=
Record
<
string
,
any
>
export
type
CustomEventTrigger
=
ReturnType
<
typeof
useCustomEvent
>
export
function
withWebEvent
(
fn
:
Function
)
{
return
((
fn
as
any
).
__wwe
=
true
),
fn
}
export
function
useCustomEvent
(
ref
:
Ref
<
HTMLElement
|
null
>
,
emit
:
SetupContext
[
'
emit
'
]
...
...
packages/uni-components/src/helpers/useListeners.ts
浏览文件 @
60b10804
import
{
isPlainObject
}
from
'
@vue/shared
'
import
{
watch
,
onUnmounted
,
getCurrentInstance
}
from
'
vue
'
export
function
/*#__PURE__*/
useListeners
(
export
function
useListeners
(
props
:
{
id
:
string
},
listeners
:
Record
<
string
,
Function
>
)
{
...
...
@@ -26,8 +26,7 @@ function _addListeners(
watch
?:
boolean
)
{
const
instance
=
getCurrentInstance
()
!
const
vm
=
instance
.
proxy
!
const
pageId
=
vm
.
$root
!
.
$page
.
id
const
pageId
=
instance
.
root
.
proxy
!
.
$page
.
id
if
(
watch
&&
!
id
)
{
// id被置空
...
...
@@ -61,8 +60,7 @@ function _removeListeners(
watch
?:
boolean
)
{
const
instance
=
getCurrentInstance
()
!
const
vm
=
instance
.
proxy
!
const
pageId
=
vm
.
$root
!
.
$page
.
id
const
pageId
=
instance
.
root
.
proxy
!
.
$page
.
id
if
(
watch
&&
!
id
)
{
// id之前不存在
...
...
packages/uni-components/src/helpers/useScopedAttrs.ts
浏览文件 @
60b10804
...
...
@@ -14,16 +14,13 @@ export function useScopedAttrs() {
})
onMounted
(()
=>
{
let
vm
=
(
getCurrentInstance
()
as
ComponentInternalInstance
).
proxy
while
(
vm
)
{
const
$options
=
vm
.
$options
const
scopeId
=
$options
.
__scopeId
let
instance
=
getCurrentInstance
()
while
(
instance
)
{
const
scopeId
=
(
instance
.
type
as
any
).
__scopeId
if
(
scopeId
)
{
const
attrs
:
Record
<
string
,
string
>
=
{}
attrs
[
scopeId
]
=
''
state
.
attrs
=
attrs
state
.
attrs
[
scopeId
]
=
''
}
vm
=
vm
.
$
parent
instance
=
instance
.
__isPage
?
null
:
instance
.
parent
}
})
...
...
packages/uni-components/src/helpers/useSubscribe.ts
浏览文件 @
60b10804
...
...
@@ -45,7 +45,8 @@ export function useSubscribe(
)
{
const
instance
=
getCurrentInstance
()
!
const
vm
=
instance
.
proxy
!
const
pageId
=
name
?
0
:
vm
.
$root
!
.
$page
.
id
// 不能直接使用instance.proxy.$root,此时可能获取到的是exposed
const
pageId
=
name
?
0
:
instance
.
root
.
proxy
!
.
$page
.
id
onMounted
(()
=>
{
addSubscribe
(
name
||
normalizeEvent
(
pageId
,
vm
)
!
,
callback
)
if
(
!
name
)
{
...
...
packages/uni-components/src/index.ts
浏览文件 @
60b10804
export
*
from
'
./components
'
export
{
useOn
,
useSubscribe
}
from
'
./helpers/useSubscribe
'
export
{
useCustomEvent
}
from
'
./helpers/useEvent
'
export
{
withWebEvent
,
useCustomEvent
}
from
'
./helpers/useEvent
'
export
{
useUserAction
}
from
'
./helpers/useUserAction
'
packages/uni-core/src/view/plugin/componentInstance.ts
浏览文件 @
60b10804
import
{
ComponentPublicInstance
}
from
'
vue
'
import
{
extend
}
from
'
@vue/shared
'
import
{
normalizeTarget
}
from
'
@dcloudio/uni-shared
'
import
{
getWindowOffset
}
from
'
../../helpers
'
// TODO 临时跳过内置组件事件处理
const
TempSkipComponents
=
[
'
UNI-CHECKBOX
'
,
'
UNI-LABEL
'
]
const
isClickEvent
=
(
val
:
Event
):
val
is
MouseEvent
=>
val
.
type
===
'
click
'
const
isMouseEvent
=
(
val
:
Event
):
val
is
MouseEvent
=>
val
.
type
.
indexOf
(
'
mouse
'
)
===
0
// normalizeNativeEvent
export
function
$nne
(
this
:
ComponentPublicInstance
,
evt
:
Event
)
{
// TODO 目前内置组件底层实现,也会进入以下处理逻辑,可能会有影响
// 目前内置组件底层实现,当需要访问原始event时,请使用withWebEvent包裹
// 用法参考:uni-h5/src/framework/components/page/page-refresh/index.ts
const
{
currentTarget
}
=
evt
if
(
!
(
evt
instanceof
Event
)
||
!
(
currentTarget
instanceof
HTMLElement
))
{
return
evt
}
const
{
tagName
}
=
currentTarget
if
(
tagName
.
indexOf
(
'
UNI-
'
)
!==
0
||
tagName
===
'
UNI-PAGE-WRAPPER
'
||
TempSkipComponents
.
indexOf
(
tagName
)
!==
-
1
)
{
// TODO 下拉刷新事件返回原始event,目前硬编码,后续换其他方案解决
if
(
currentTarget
.
tagName
.
indexOf
(
'
UNI-
'
)
!==
0
)
{
return
evt
}
...
...
@@ -42,29 +36,34 @@ export function $nne(this: ComponentPublicInstance, evt: Event) {
function
createNativeEvent
(
evt
:
Event
)
{
const
{
type
,
timeStamp
,
currentTarget
}
=
evt
const
target
=
normalizeTarget
(
currentTarget
as
HTMLElement
)
return
{
const
event
=
{
type
,
timeStamp
,
target
,
detail
:
{},
currentTarget
:
target
,
preventDefault
()
{
if
(
__DEV__
)
{
console
.
warn
(
'
preventDefault is only supported in h5, use `.prevent` instead.
'
)
}
return
evt
.
preventDefault
()
},
stopPropagation
()
{
if
(
__DEV__
)
{
console
.
warn
(
'
stopPropagation is only supported in h5, use `.stop` instead.
'
)
}
return
evt
.
stopPropagation
()
},
}
if
(
__PLATFORM__
===
'
h5
'
)
{
extend
(
event
,
{
preventDefault
()
{
if
(
__DEV__
)
{
console
.
warn
(
'
preventDefault is only supported in h5, use `.prevent` instead.
'
)
}
return
evt
.
preventDefault
()
},
stopPropagation
()
{
if
(
__DEV__
)
{
console
.
warn
(
'
stopPropagation is only supported in h5, use `.stop` instead.
'
)
}
return
evt
.
stopPropagation
()
},
})
}
return
event
}
function
normalizeClickEvent
(
...
...
packages/uni-h5-vue/dist/vue.runtime.esm.js
浏览文件 @
60b10804
...
...
@@ -8403,7 +8403,19 @@ function createInvoker(initialValue, instance) {
// fixed by xxxxxx
const
proxy
=
instance
&&
instance
.
proxy
;
const
normalizeNativeEvent
=
proxy
&&
proxy
.
$nne
;
callWithAsyncErrorHandling
(
patchStopImmediatePropagation
(
e
,
invoker
.
value
),
instance
,
5
/* NATIVE_EVENT_HANDLER */
,
[
normalizeNativeEvent
?
normalizeNativeEvent
(
e
)
:
e
]);
if
(
normalizeNativeEvent
&&
isArray
(
invoker
.
value
))
{
const
fns
=
invoker
.
value
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
const
fn
=
fns
[
i
];
callWithAsyncErrorHandling
(
fn
,
instance
,
5
/* NATIVE_EVENT_HANDLER */
,
[
!
fn
.
__wwe
?
normalizeNativeEvent
(
e
)
:
e
]);
}
return
;
}
callWithAsyncErrorHandling
(
patchStopImmediatePropagation
(
e
,
invoker
.
value
),
instance
,
5
/* NATIVE_EVENT_HANDLER */
,
[
normalizeNativeEvent
&&
!
invoker
.
value
.
__wwe
?
normalizeNativeEvent
(
e
)
:
e
]);
}
};
invoker
.
value
=
initialValue
;
...
...
@@ -8448,7 +8460,7 @@ const forcePatchProp = (_, key) => key === 'value';
const
patchProp
=
(
el
,
key
,
prevValue
,
nextValue
,
isSVG
=
false
,
prevChildren
,
parentComponent
,
parentSuspense
,
unmountChildren
)
=>
{
// @ts-expect-error fixed by xxxxxx
if
(
__UNI_FEATURE_WXS__
&&
key
.
indexOf
(
'
change:
'
)
===
0
)
{
patchWxs
(
el
,
key
,
nextValue
,
parentComponent
);
return
patchWxs
(
el
,
key
,
nextValue
,
parentComponent
);
}
switch
(
key
)
{
// special
...
...
packages/uni-h5-vue/lib/vue.runtime.esm.js
浏览文件 @
60b10804
...
...
@@ -8403,7 +8403,19 @@ function createInvoker(initialValue, instance) {
// fixed by xxxxxx
const
proxy
=
instance
&&
instance
.
proxy
;
const
normalizeNativeEvent
=
proxy
&&
proxy
.
$nne
;
callWithAsyncErrorHandling
(
patchStopImmediatePropagation
(
e
,
invoker
.
value
),
instance
,
5
/* NATIVE_EVENT_HANDLER */
,
[
normalizeNativeEvent
?
normalizeNativeEvent
(
e
)
:
e
]);
if
(
normalizeNativeEvent
&&
isArray
(
invoker
.
value
))
{
const
fns
=
invoker
.
value
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
const
fn
=
fns
[
i
];
callWithAsyncErrorHandling
(
fn
,
instance
,
5
/* NATIVE_EVENT_HANDLER */
,
[
!
fn
.
__wwe
?
normalizeNativeEvent
(
e
)
:
e
]);
}
return
;
}
callWithAsyncErrorHandling
(
patchStopImmediatePropagation
(
e
,
invoker
.
value
),
instance
,
5
/* NATIVE_EVENT_HANDLER */
,
[
normalizeNativeEvent
&&
!
invoker
.
value
.
__wwe
?
normalizeNativeEvent
(
e
)
:
e
]);
}
};
invoker
.
value
=
initialValue
;
...
...
@@ -8448,7 +8460,7 @@ const forcePatchProp = (_, key) => key === 'value';
const
patchProp
=
(
el
,
key
,
prevValue
,
nextValue
,
isSVG
=
false
,
prevChildren
,
parentComponent
,
parentSuspense
,
unmountChildren
)
=>
{
// @ts-expect-error fixed by xxxxxx
if
(
__UNI_FEATURE_WXS__
&&
key
.
indexOf
(
'
change:
'
)
===
0
)
{
patchWxs
(
el
,
key
,
nextValue
,
parentComponent
);
return
patchWxs
(
el
,
key
,
nextValue
,
parentComponent
);
}
switch
(
key
)
{
// special
...
...
packages/uni-h5/dist/uni-h5.esm.js
浏览文件 @
60b10804
...
...
@@ -678,7 +678,7 @@ var safeAreaInsets = {
onChange
,
offChange
};
var
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
=
safeAreaInsets
;
var
out
=
safeAreaInsets
;
const
onEventPrevent
=
/* @__PURE__ */
withModifiers
(()
=>
{
},
[
"
prevent
"
]);
const
onEventStop
=
/* @__PURE__ */
withModifiers
(()
=>
{
...
...
@@ -690,10 +690,10 @@ function getWindowOffset() {
const
left
=
parseInt
(
style2
.
getPropertyValue
(
"
--window-left
"
));
const
right
=
parseInt
(
style2
.
getPropertyValue
(
"
--window-right
"
));
return
{
top
:
top
?
top
+
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
top
:
0
,
bottom
:
bottom
?
bottom
+
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
bottom
:
0
,
left
:
left
?
left
+
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
left
:
0
,
right
:
right
?
right
+
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
right
:
0
top
:
top
?
top
+
out
.
top
:
0
,
bottom
:
bottom
?
bottom
+
out
.
bottom
:
0
,
left
:
left
?
left
+
out
.
left
:
0
,
right
:
right
?
right
+
out
.
right
:
0
};
}
const
style
=
document
.
documentElement
.
style
;
...
...
@@ -857,7 +857,6 @@ function getRealRoute(fromRoute, toRoute) {
fromRouteArray
.
splice
(
fromRouteArray
.
length
-
i2
-
1
,
i2
+
1
);
return
"
/
"
+
fromRouteArray
.
concat
(
toRouteArray
).
join
(
"
/
"
);
}
const
TempSkipComponents
=
[
"
UNI-CHECKBOX
"
,
"
UNI-LABEL
"
];
const
isClickEvent
=
(
val
)
=>
val
.
type
===
"
click
"
;
const
isMouseEvent
=
(
val
)
=>
val
.
type
.
indexOf
(
"
mouse
"
)
===
0
;
function
$nne
(
evt
)
{
...
...
@@ -865,8 +864,7 @@ function $nne(evt) {
if
(
!
(
evt
instanceof
Event
)
||
!
(
currentTarget
instanceof
HTMLElement
))
{
return
evt
;
}
const
{
tagName
}
=
currentTarget
;
if
(
tagName
.
indexOf
(
"
UNI-
"
)
!==
0
||
tagName
===
"
UNI-PAGE-WRAPPER
"
||
TempSkipComponents
.
indexOf
(
tagName
)
!==
-
1
)
{
if
(
currentTarget
.
tagName
.
indexOf
(
"
UNI-
"
)
!==
0
)
{
return
evt
;
}
const
res
=
createNativeEvent
(
evt
);
...
...
@@ -884,25 +882,30 @@ function $nne(evt) {
function
createNativeEvent
(
evt
)
{
const
{
type
,
timeStamp
,
currentTarget
}
=
evt
;
const
target
=
normalizeTarget
(
currentTarget
);
return
{
const
event2
=
{
type
,
timeStamp
,
target
,
detail
:
{},
currentTarget
:
target
,
preventDefault
()
{
if
(
process
.
env
.
NODE_ENV
!==
"
production
"
)
{
console
.
warn
(
"
preventDefault is only supported in h5, use `.prevent` instead.
"
);
}
return
evt
.
preventDefault
();
},
stopPropagation
()
{
if
(
process
.
env
.
NODE_ENV
!==
"
production
"
)
{
console
.
warn
(
"
stopPropagation is only supported in h5, use `.stop` instead.
"
);
}
return
evt
.
stopPropagation
();
}
currentTarget
:
target
};
{
extend
(
event2
,
{
preventDefault
()
{
if
(
process
.
env
.
NODE_ENV
!==
"
production
"
)
{
console
.
warn
(
"
preventDefault is only supported in h5, use `.prevent` instead.
"
);
}
return
evt
.
preventDefault
();
},
stopPropagation
()
{
if
(
process
.
env
.
NODE_ENV
!==
"
production
"
)
{
console
.
warn
(
"
stopPropagation is only supported in h5, use `.stop` instead.
"
);
}
return
evt
.
stopPropagation
();
}
});
}
return
event2
;
}
function
normalizeClickEvent
(
evt
,
mouseEvt
)
{
const
{
x
,
y
}
=
mouseEvt
;
...
...
@@ -1329,7 +1332,7 @@ function normalizePageMeta(pageMeta) {
let
offset
=
rpx2px
(
refreshOptions
.
offset
);
const
{
type
}
=
navigationBar
;
if
(
type
!==
"
transparent
"
&&
type
!==
"
none
"
)
{
offset
+=
NAVBAR_HEIGHT
+
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
top
;
offset
+=
NAVBAR_HEIGHT
+
out
.
top
;
}
refreshOptions
.
offset
=
offset
;
refreshOptions
.
height
=
rpx2px
(
refreshOptions
.
height
);
...
...
@@ -3803,6 +3806,7 @@ function setupPage(comp) {
return
setupComponent
(
comp
,
{
init
:
initPage
,
setup
(
instance2
)
{
instance2
.
__isPage
=
true
;
instance2
.
root
=
instance2
;
const
route
=
usePageRoute
();
if
(
route
.
meta
.
isTabBar
)
{
...
...
@@ -5031,8 +5035,7 @@ function useListeners(props2, listeners2) {
}
function
_addListeners
(
id2
,
listeners2
,
watch2
)
{
const
instance2
=
getCurrentInstance
();
const
vm
=
instance2
.
proxy
;
const
pageId
=
vm
.
$root
.
$page
.
id
;
const
pageId
=
instance2
.
root
.
proxy
.
$page
.
id
;
if
(
watch2
&&
!
id2
)
{
return
;
}
...
...
@@ -5055,8 +5058,7 @@ function _addListeners(id2, listeners2, watch2) {
}
function
_removeListeners
(
id2
,
listeners2
,
watch2
)
{
const
instance2
=
getCurrentInstance
();
const
vm
=
instance2
.
proxy
;
const
pageId
=
vm
.
$root
.
$page
.
id
;
const
pageId
=
instance2
.
root
.
proxy
.
$page
.
id
;
if
(
watch2
&&
!
id2
)
{
return
;
}
...
...
@@ -5077,6 +5079,9 @@ function _removeListeners(id2, listeners2, watch2) {
}
});
}
function
withWebEvent
(
fn
)
{
return
fn
.
__wwe
=
true
,
fn
;
}
function
useCustomEvent
(
ref2
,
emit2
)
{
return
(
name
,
evt
,
detail
)
=>
{
emit2
(
name
,
normalizeCustomEvent
(
name
,
evt
,
ref2
.
value
,
detail
||
{}));
...
...
@@ -5167,11 +5172,10 @@ var index$b = /* @__PURE__ */ defineComponent({
slots
})
{
const
instance2
=
getCurrentInstance
();
const
vm
=
instance2
.
proxy
;
const
pageId
=
vm
.
$root
.
$page
.
id
;
const
pageId
=
instance2
.
root
.
proxy
.
$page
.
id
;
const
handlers
=
useProvideLabel
();
const
pointer
=
computed
(()
=>
props2
.
for
||
slots
.
default
&&
slots
.
default
.
length
);
const
_onClick
=
(
$event
)
=>
{
const
_onClick
=
withWebEvent
(
(
$event
)
=>
{
const
EventTarget
=
$event
.
target
;
let
stopPropagation
=
/^uni-
(
checkbox|radio|switch
)
-/
.
test
(
EventTarget
.
className
);
if
(
!
stopPropagation
)
{
...
...
@@ -5190,7 +5194,7 @@ var index$b = /* @__PURE__ */ defineComponent({
handler
(
$event
,
true
);
});
}
};
}
)
;
return
()
=>
createVNode
(
"
uni-label
"
,
{
class
:
{
"
uni-label-pointer
"
:
pointer
...
...
@@ -6512,16 +6516,13 @@ function useScopedAttrs() {
attrs
:
{}
});
onMounted
(()
=>
{
let
vm
=
getCurrentInstance
().
proxy
;
while
(
vm
)
{
const
$options
=
vm
.
$options
;
const
scopeId
=
$options
.
__scopeId
;
let
instance2
=
getCurrentInstance
();
while
(
instance2
)
{
const
scopeId
=
instance2
.
type
.
__scopeId
;
if
(
scopeId
)
{
const
attrs2
=
{};
attrs2
[
scopeId
]
=
""
;
state
.
attrs
=
attrs2
;
state
.
attrs
[
scopeId
]
=
""
;
}
vm
=
vm
.
$
parent
;
instance2
=
instance2
.
__isPage
?
null
:
instance2
.
parent
;
}
});
return
{
...
...
@@ -10320,7 +10321,7 @@ function removeSubscribe(name) {
function
useSubscribe
(
callback
,
name
)
{
const
instance2
=
getCurrentInstance
();
const
vm
=
instance2
.
proxy
;
const
pageId
=
name
?
0
:
vm
.
$root
.
$page
.
id
;
const
pageId
=
name
?
0
:
instance2
.
root
.
proxy
.
$page
.
id
;
onMounted
(()
=>
{
addSubscribe
(
name
||
normalizeEvent
(
pageId
,
vm
),
callback
);
if
(
!
name
)
{
...
...
@@ -11428,7 +11429,7 @@ const getSystemInfoSync = defineSyncApi("getSystemInfoSync", () => {
const
windowWidth
=
getWindowWidth
(
screenWidth
);
let
windowHeight
=
window
.
innerHeight
;
const
language
=
navigator
.
language
;
const
statusBarHeight
=
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
top
;
const
statusBarHeight
=
out
.
top
;
let
osname
;
let
osversion
;
let
model
;
...
...
@@ -11541,12 +11542,12 @@ const getSystemInfoSync = defineSyncApi("getSystemInfoSync", () => {
const
system
=
`
${
osname
}
${
osversion
}
`
;
const
platform
=
osname
.
toLocaleLowerCase
();
const
safeArea
=
{
left
:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
left
,
right
:
windowWidth
-
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
right
,
top
:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
top
,
bottom
:
windowHeight
-
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
bottom
,
width
:
windowWidth
-
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out
.
left
-
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
right
,
height
:
windowHeight
-
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out
.
top
-
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
bottom
left
:
out
.
left
,
right
:
windowWidth
-
out
.
right
,
top
:
out
.
top
,
bottom
:
windowHeight
-
out
.
bottom
,
width
:
windowWidth
-
out
.
left
-
out
.
right
,
height
:
windowHeight
-
out
.
top
-
out
.
bottom
};
const
{
top
:
windowTop
,
bottom
:
windowBottom
}
=
getWindowOffset
();
windowHeight
-=
windowTop
;
...
...
@@ -11566,10 +11567,10 @@ const getSystemInfoSync = defineSyncApi("getSystemInfoSync", () => {
model
,
safeArea
,
safeAreaInsets
:
{
top
:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
top
,
right
:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
right
,
bottom
:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
bottom
,
left
:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out
.
left
top
:
out
.
top
,
right
:
out
.
right
,
bottom
:
out
.
bottom
,
left
:
out
.
left
}
};
});
...
...
@@ -14392,7 +14393,7 @@ function usePageRefresh(refreshRef) {
refreshControllerElemStyle
.
clip
=
"
rect(
"
+
(
45
-
y
)
+
"
px,45px,45px,-5px)
"
;
refreshControllerElemStyle
.
transform
=
"
translate3d(-50%,
"
+
y
+
"
px, 0)
"
;
}
function
onTouchstartPassive
(
ev
)
{
const
onTouchstartPassive
=
withWebEvent
((
ev
)
=>
{
const
touch
=
ev
.
changedTouches
[
0
];
touchId
=
touch
.
identifier
;
startY
=
touch
.
pageY
;
...
...
@@ -14401,8 +14402,8 @@ function usePageRefresh(refreshRef) {
}
else
{
canRefresh
=
true
;
}
}
function
onTouchmove
(
ev
)
{
}
);
const
onTouchmove
=
withWebEvent
((
ev
)
=>
{
if
(
!
canRefresh
)
{
return
;
}
...
...
@@ -14436,8 +14437,8 @@ function usePageRefresh(refreshRef) {
addClass
();
}
pulling
(
deltaY
);
}
function
onTouchend
(
ev
)
{
}
);
const
onTouchend
=
withWebEvent
((
ev
)
=>
{
if
(
!
processDeltaY
(
ev
,
touchId
,
startY
))
{
return
;
}
...
...
@@ -14458,7 +14459,7 @@ function usePageRefresh(refreshRef) {
addClass
();
refreshing
();
}
}
}
);
function
aborting
(
callback
)
{
if
(
!
refreshControllerElem
)
{
return
;
...
...
@@ -14575,4 +14576,4 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
]);
}
_sfc_main
.
render
=
_sfc_render
;
export
{
_sfc_main$1
as
AsyncErrorComponent
,
_sfc_main
as
AsyncLoadingComponent
,
_sfc_main$d
as
Audio
,
index$d
as
Button
,
_sfc_main$c
as
Canvas
,
index$a
as
Checkbox
,
index$c
as
CheckboxGroup
,
index$9
as
Editor
,
index$e
as
Form
,
index$8
as
Icon
,
index$7
as
Image
,
Input
,
index$b
as
Label
,
LayoutComponent
,
_sfc_main$b
as
MovableView
,
_sfc_main$a
as
Navigator
,
index
as
PageComponent
,
index$6
as
Progress
,
_sfc_main$9
as
Radio
,
_sfc_main$8
as
RadioGroup
,
ResizeSensor
,
_sfc_main$7
as
RichText
,
_sfc_main$6
as
ScrollView
,
_sfc_main$5
as
Slider
,
_sfc_main$4
as
SwiperItem
,
_sfc_main$3
as
Switch
,
index$5
as
Text
,
index$4
as
Textarea
,
UniServiceJSBridge$1
as
UniServiceJSBridge
,
UniViewJSBridge$1
as
UniViewJSBridge
,
index$2
as
Video
,
index$3
as
View
,
index$1
as
WebView
,
addInterceptor
,
arrayBufferToBase64
,
base64ToArrayBuffer
,
canIUse
,
chooseFile
,
chooseImage
,
chooseVideo
,
clearStorage
,
clearStorageSync
,
closeSocket
,
connectSocket
,
createInnerAudioContext
,
createIntersectionObserver
,
createSelectorQuery
,
createVideoContext
,
cssBackdropFilter
,
cssConstant
,
cssEnv
,
cssVar
,
downloadFile
,
getApp$1
as
getApp
,
getCurrentPages$1
as
getCurrentPages
,
getFileInfo
,
getImageInfo
,
getLocation
,
getNetworkType
,
getStorage
,
getStorageInfo
,
getStorageInfoSync
,
getStorageSync
,
getSystemInfo
,
getSystemInfoSync
,
getVideoInfo
,
hideKeyboard
,
hideLoading
,
hideNavigationBarLoading
,
hideTabBar
,
hideTabBarRedDot
,
hideToast
,
loadFontFace
,
makePhoneCall
,
navigateBack
,
navigateTo
,
offAccelerometerChange
,
offCompassChange
,
offNetworkStatusChange
,
onAccelerometerChange
,
onCompassChange
,
onNetworkStatusChange
,
onSocketClose
,
onSocketError
,
onSocketMessage
,
onSocketOpen
,
onTabBarMidButtonTap
,
openDocument
,
pageScrollTo
,
index$f
as
plugin
,
promiseInterceptor
,
reLaunch
,
redirectTo
,
removeInterceptor
,
removeStorage
,
removeStorageSync
,
removeTabBarBadge
,
request
,
sendSocketMessage
,
setNavigationBarColor
,
setNavigationBarTitle
,
setStorage
,
setStorageSync
,
setTabBarBadge
,
setTabBarItem
,
setTabBarStyle
,
setupApp
,
setupPage
,
showLoading
,
showModal
,
showNavigationBarLoading
,
showTabBar
,
showTabBarRedDot
,
showToast
,
startAccelerometer
,
startCompass
,
startPullDownRefresh
,
stopAccelerometer
,
stopCompass
,
stopPullDownRefresh
,
switchTab
,
uni$1
as
uni
,
uploadFile
,
upx2px
,
useCustomEvent
,
useOn
,
useSubscribe
,
useUserAction
,
vibrateLong
,
vibrateShort
};
export
{
_sfc_main$1
as
AsyncErrorComponent
,
_sfc_main
as
AsyncLoadingComponent
,
_sfc_main$d
as
Audio
,
index$d
as
Button
,
_sfc_main$c
as
Canvas
,
index$a
as
Checkbox
,
index$c
as
CheckboxGroup
,
index$9
as
Editor
,
index$e
as
Form
,
index$8
as
Icon
,
index$7
as
Image
,
Input
,
index$b
as
Label
,
LayoutComponent
,
_sfc_main$b
as
MovableView
,
_sfc_main$a
as
Navigator
,
index
as
PageComponent
,
index$6
as
Progress
,
_sfc_main$9
as
Radio
,
_sfc_main$8
as
RadioGroup
,
ResizeSensor
,
_sfc_main$7
as
RichText
,
_sfc_main$6
as
ScrollView
,
_sfc_main$5
as
Slider
,
_sfc_main$4
as
SwiperItem
,
_sfc_main$3
as
Switch
,
index$5
as
Text
,
index$4
as
Textarea
,
UniServiceJSBridge$1
as
UniServiceJSBridge
,
UniViewJSBridge$1
as
UniViewJSBridge
,
index$2
as
Video
,
index$3
as
View
,
index$1
as
WebView
,
addInterceptor
,
arrayBufferToBase64
,
base64ToArrayBuffer
,
canIUse
,
chooseFile
,
chooseImage
,
chooseVideo
,
clearStorage
,
clearStorageSync
,
closeSocket
,
connectSocket
,
createInnerAudioContext
,
createIntersectionObserver
,
createSelectorQuery
,
createVideoContext
,
cssBackdropFilter
,
cssConstant
,
cssEnv
,
cssVar
,
downloadFile
,
getApp$1
as
getApp
,
getCurrentPages$1
as
getCurrentPages
,
getFileInfo
,
getImageInfo
,
getLocation
,
getNetworkType
,
getStorage
,
getStorageInfo
,
getStorageInfoSync
,
getStorageSync
,
getSystemInfo
,
getSystemInfoSync
,
getVideoInfo
,
hideKeyboard
,
hideLoading
,
hideNavigationBarLoading
,
hideTabBar
,
hideTabBarRedDot
,
hideToast
,
loadFontFace
,
makePhoneCall
,
navigateBack
,
navigateTo
,
offAccelerometerChange
,
offCompassChange
,
offNetworkStatusChange
,
onAccelerometerChange
,
onCompassChange
,
onNetworkStatusChange
,
onSocketClose
,
onSocketError
,
onSocketMessage
,
onSocketOpen
,
onTabBarMidButtonTap
,
openDocument
,
pageScrollTo
,
index$f
as
plugin
,
promiseInterceptor
,
reLaunch
,
redirectTo
,
removeInterceptor
,
removeStorage
,
removeStorageSync
,
removeTabBarBadge
,
request
,
sendSocketMessage
,
setNavigationBarColor
,
setNavigationBarTitle
,
setStorage
,
setStorageSync
,
setTabBarBadge
,
setTabBarItem
,
setTabBarStyle
,
setupApp
,
setupPage
,
showLoading
,
showModal
,
showNavigationBarLoading
,
showTabBar
,
showTabBarRedDot
,
showToast
,
startAccelerometer
,
startCompass
,
startPullDownRefresh
,
stopAccelerometer
,
stopCompass
,
stopPullDownRefresh
,
switchTab
,
uni$1
as
uni
,
uploadFile
,
upx2px
,
useCustomEvent
,
useOn
,
useSubscribe
,
useUserAction
,
vibrateLong
,
vibrateShort
,
withWebEvent
};
packages/uni-h5/src/framework/components/page/page-refresh/index.ts
浏览文件 @
60b10804
...
...
@@ -4,7 +4,7 @@ import {
API_START_PULL_DOWN_REFRESH
,
API_STOP_PULL_DOWN_REFRESH
,
}
from
'
@dcloudio/uni-api
'
import
{
useSubscribe
}
from
'
@dcloudio/uni-components
'
import
{
useSubscribe
,
withWebEvent
}
from
'
@dcloudio/uni-components
'
import
{
usePageMeta
}
from
'
../../../setup/provide
'
function
processDeltaY
(
...
...
@@ -117,7 +117,7 @@ export function usePageRefresh(refreshRef: Ref) {
refreshControllerElemStyle
.
transform
=
'
translate3d(-50%,
'
+
y
+
'
px, 0)
'
}
function
onTouchstartPassive
(
ev
:
TouchEvent
)
{
const
onTouchstartPassive
=
withWebEvent
((
ev
:
TouchEvent
)
=>
{
const
touch
=
ev
.
changedTouches
[
0
]
touchId
=
touch
.
identifier
startY
=
touch
.
pageY
...
...
@@ -126,9 +126,9 @@ export function usePageRefresh(refreshRef: Ref) {
}
else
{
canRefresh
=
true
}
}
}
)
function
onTouchmove
(
ev
:
TouchEvent
)
{
const
onTouchmove
=
withWebEvent
((
ev
:
TouchEvent
)
=>
{
if
(
!
canRefresh
)
{
return
}
...
...
@@ -171,9 +171,9 @@ export function usePageRefresh(refreshRef: Ref) {
}
pulling
(
deltaY
!
)
}
}
)
function
onTouchend
(
ev
:
TouchEvent
)
{
const
onTouchend
=
withWebEvent
((
ev
:
TouchEvent
)
=>
{
if
(
!
processDeltaY
(
ev
,
touchId
,
startY
))
{
return
}
...
...
@@ -194,7 +194,7 @@ export function usePageRefresh(refreshRef: Ref) {
addClass
()
refreshing
()
}
}
}
)
function
aborting
(
callback
:
Function
)
{
if
(
!
refreshControllerElem
)
{
...
...
packages/uni-h5/src/framework/setup/index.ts
浏览文件 @
60b10804
...
...
@@ -53,6 +53,7 @@ export function setupPage(comp: any) {
return
setupComponent
(
comp
,
{
init
:
initPage
,
setup
(
instance
)
{
instance
.
__isPage
=
true
// 标记当前组件是页面
instance
.
root
=
instance
// 组件root指向页面
const
route
=
usePageRoute
()
if
(
route
.
meta
.
isTabBar
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录