Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
anyefeiyu
uni-app
提交
57721682
U
uni-app
项目概览
anyefeiyu
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
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,发现更多精彩内容 >>
提交
57721682
编写于
11月 01, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(v3): touches
上级
e63bf48f
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
4737 addition
and
4518 deletion
+4737
-4518
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+25
-25
packages/uni-app-plus/dist/view.css
packages/uni-app-plus/dist/view.css
+9
-0
packages/uni-app-plus/dist/view.umd.js
packages/uni-app-plus/dist/view.umd.js
+4676
-4464
src/core/view/plugins/events.js
src/core/view/plugins/events.js
+3
-5
src/platforms/app-plus/service/framework/plugins/vdom-sync.js
...platforms/app-plus/service/framework/plugins/vdom-sync.js
+24
-24
未找到文件。
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
57721682
...
...
@@ -9575,7 +9575,7 @@ var serviceContext = (function () {
return
}
if
(
isLaunchWebview
)
{
// 首页
isLaunchWebviewReady
=
true
;
// isLaunchWebviewReady = true
setPreloadWebview
(
plus
.
webview
.
getLaunchWebview
());
}
else
if
(
!
preloadWebview
)
{
// preloadWebview 不存在,重新加载一下
setPreloadWebview
(
plus
.
webview
.
getWebviewById
(
pageId
));
...
...
@@ -9908,7 +9908,7 @@ var serviceContext = (function () {
};
}
function
wrapperEvent
(
event
)
{
function
wrapperEvent
(
event
)
{
event
.
preventDefault
=
noop
;
event
.
stopPropagation
=
noop
;
event
.
mp
=
event
;
...
...
@@ -9918,7 +9918,7 @@ var serviceContext = (function () {
}
const
handleVdData
=
{
[
UI_EVENT
]:
function
onUIEvent
(
vdBatchEvent
,
vd
)
{
[
UI_EVENT
]:
function
onUIEvent
(
vdBatchEvent
,
vd
)
{
vdBatchEvent
.
forEach
(([
cid
,
nid
,
event
])
=>
{
nid
=
String
(
nid
);
const
target
=
vd
.
elements
.
find
(
target
=>
target
.
cid
===
cid
&&
target
.
nid
===
nid
);
...
...
@@ -9930,14 +9930,14 @@ var serviceContext = (function () {
}
};
function
onVdSync$1
(
vdBatchData
,
vd
)
{
function
onVdSync$1
(
vdBatchData
,
vd
)
{
vdBatchData
.
forEach
(([
type
,
vdData
])
=>
{
handleVdData
[
type
](
vdData
,
vd
);
});
}
class
VDomSync
{
constructor
(
pageId
,
pagePath
,
pageVm
)
{
constructor
(
pageId
,
pagePath
,
pageVm
)
{
this
.
pageId
=
pageId
;
this
.
pagePath
=
pagePath
;
this
.
pageVm
=
pageVm
;
...
...
@@ -9952,47 +9952,47 @@ var serviceContext = (function () {
this
.
_init
();
}
_init
()
{
_init
()
{
registerVdSync
(
this
.
pageId
,
(
vdBatchData
)
=>
{
onVdSync$1
(
vdBatchData
,
this
);
});
}
addMountedVm
(
vm
)
{
addMountedVm
(
vm
)
{
vm
.
_$mounted
();
// 触发vd数据同步
this
.
addVdSyncCallback
(
function
mounted
()
{
this
.
addVdSyncCallback
(
function
mounted
()
{
vm
.
__call_hook
(
'
mounted
'
);
});
}
addUpdatedVm
(
vm
)
{
addUpdatedVm
(
vm
)
{
vm
.
_$updated
();
// 触发vd数据同步
this
.
addVdSyncCallback
(
function
mounted
()
{
this
.
addVdSyncCallback
(
function
mounted
()
{
vm
.
__call_hook
(
'
updated
'
);
});
}
addVdSyncCallback
(
callback
)
{
addVdSyncCallback
(
callback
)
{
isFn
(
callback
)
&&
vdSyncCallbacks
.
push
(
callback
);
}
getVm
(
id
)
{
getVm
(
id
)
{
return
this
.
vms
[
id
]
}
addVm
(
vm
)
{
addVm
(
vm
)
{
this
.
vms
[
vm
.
_$id
]
=
vm
;
}
removeVm
(
vm
)
{
removeVm
(
vm
)
{
delete
this
.
vms
[
vm
.
_$id
];
}
addElement
(
elm
)
{
addElement
(
elm
)
{
this
.
elements
.
indexOf
(
elm
)
===
-
1
&&
this
.
elements
.
push
(
elm
);
}
removeElement
(
elm
)
{
removeElement
(
elm
)
{
const
elmIndex
=
this
.
elements
.
indexOf
(
elm
);
if
(
elmIndex
===
-
1
)
{
return
console
.
error
(
`removeElement[
${
elm
.
cid
}
][
${
elm
.
nid
}
] not found`
)
...
...
@@ -10000,11 +10000,11 @@ var serviceContext = (function () {
this
.
elements
.
splice
(
elmIndex
,
1
);
}
push
(
type
,
cid
,
data
)
{
push
(
type
,
cid
,
data
)
{
this
.
batchData
.
push
([
type
,
[
cid
,
data
]]);
}
sendPageCreate
(
data
)
{
sendPageCreate
(
data
)
{
this
.
pageCreateData
=
data
;
UniServiceJSBridge
.
publishHandler
(
VD_SYNC
,
{
data
:
[
...
...
@@ -10016,7 +10016,7 @@ var serviceContext = (function () {
},
[
this
.
pageId
]);
}
flush
()
{
flush
()
{
if
(
!
this
.
initialized
)
{
this
.
initialized
=
true
;
this
.
batchData
.
push
([
PAGE_CREATED
,
[
this
.
pageId
,
this
.
pagePath
]]);
...
...
@@ -10032,26 +10032,26 @@ var serviceContext = (function () {
}
}
restorePageCreate
()
{
restorePageCreate
()
{
this
.
batchData
.
push
([
PAGE_CREATE
,
this
.
pageCreateData
]);
}
restoreMountedData
()
{
restoreMountedData
()
{
const
addMountedData
=
(
vm
)
=>
{
if
(
vm
.
_$id
)
{
this
.
push
(
MOUNTED_DATA
,
vm
.
_$id
,
vm
.
_$data
);
}
// vue 中 $children 顺序不可靠,可能存在恢复误差
//
TODO
vue 中 $children 顺序不可靠,可能存在恢复误差
vm
.
$children
.
forEach
(
childVm
=>
addMountedData
(
childVm
));
};
addMountedData
(
this
.
pageVm
);
}
restorePageCreated
()
{
restorePageCreated
()
{
this
.
batchData
.
push
([
PAGE_CREATED
,
[
this
.
pageId
,
this
.
pagePath
]]);
}
restore
()
{
restore
()
{
this
.
initialized
=
true
;
this
.
batchData
.
length
=
0
;
...
...
@@ -10062,7 +10062,7 @@ var serviceContext = (function () {
this
.
flush
();
}
destroy
()
{
destroy
()
{
this
.
batchData
.
length
=
0
;
this
.
vms
=
Object
.
create
(
null
);
this
.
initialized
=
false
;
...
...
packages/uni-app-plus/dist/view.css
浏览文件 @
57721682
...
...
@@ -1391,3 +1391,12 @@ uni-video[hidden] {
pointer-events
:
none
;
}
uni-web-view
{
position
:
absolute
;
left
:
0
;
right
:
0
;
top
:
0
;
bottom
:
0
;
}
packages/uni-app-plus/dist/view.umd.js
浏览文件 @
57721682
此差异已折叠。
点击以展开。
src/core/view/plugins/events.js
浏览文件 @
57721682
...
...
@@ -125,11 +125,9 @@ function touchstart (evt) {
return
}
const
{
touches
:
[{
pageX
,
pageY
}]
}
=
evt
pageX
,
pageY
}
=
evt
.
touches
[
0
]
startPageX
=
pageX
startPageY
=
pageY
...
...
src/platforms/app-plus/service/framework/plugins/vdom-sync.js
浏览文件 @
57721682
...
...
@@ -20,7 +20,7 @@ import {
vdSyncCallbacks
}
from
'
../subscribe-handlers/on-vd-sync-callback
'
function
wrapperEvent
(
event
)
{
function
wrapperEvent
(
event
)
{
event
.
preventDefault
=
noop
event
.
stopPropagation
=
noop
event
.
mp
=
event
...
...
@@ -30,7 +30,7 @@ function wrapperEvent(event) {
}
const
handleVdData
=
{
[
UI_EVENT
]:
function
onUIEvent
(
vdBatchEvent
,
vd
)
{
[
UI_EVENT
]:
function
onUIEvent
(
vdBatchEvent
,
vd
)
{
vdBatchEvent
.
forEach
(([
cid
,
nid
,
event
])
=>
{
nid
=
String
(
nid
)
const
target
=
vd
.
elements
.
find
(
target
=>
target
.
cid
===
cid
&&
target
.
nid
===
nid
)
...
...
@@ -42,14 +42,14 @@ const handleVdData = {
}
}
function
onVdSync
(
vdBatchData
,
vd
)
{
function
onVdSync
(
vdBatchData
,
vd
)
{
vdBatchData
.
forEach
(([
type
,
vdData
])
=>
{
handleVdData
[
type
](
vdData
,
vd
)
})
}
export
class
VDomSync
{
constructor
(
pageId
,
pagePath
,
pageVm
)
{
constructor
(
pageId
,
pagePath
,
pageVm
)
{
this
.
pageId
=
pageId
this
.
pagePath
=
pagePath
this
.
pageVm
=
pageVm
...
...
@@ -64,47 +64,47 @@ export class VDomSync {
this
.
_init
()
}
_init
()
{
_init
()
{
registerVdSync
(
this
.
pageId
,
(
vdBatchData
)
=>
{
onVdSync
(
vdBatchData
,
this
)
})
}
addMountedVm
(
vm
)
{
addMountedVm
(
vm
)
{
vm
.
_$mounted
()
// 触发vd数据同步
this
.
addVdSyncCallback
(
function
mounted
()
{
this
.
addVdSyncCallback
(
function
mounted
()
{
vm
.
__call_hook
(
'
mounted
'
)
})
}
addUpdatedVm
(
vm
)
{
addUpdatedVm
(
vm
)
{
vm
.
_$updated
()
// 触发vd数据同步
this
.
addVdSyncCallback
(
function
mounted
()
{
this
.
addVdSyncCallback
(
function
mounted
()
{
vm
.
__call_hook
(
'
updated
'
)
})
}
addVdSyncCallback
(
callback
)
{
addVdSyncCallback
(
callback
)
{
isFn
(
callback
)
&&
vdSyncCallbacks
.
push
(
callback
)
}
getVm
(
id
)
{
getVm
(
id
)
{
return
this
.
vms
[
id
]
}
addVm
(
vm
)
{
addVm
(
vm
)
{
this
.
vms
[
vm
.
_$id
]
=
vm
}
removeVm
(
vm
)
{
removeVm
(
vm
)
{
delete
this
.
vms
[
vm
.
_$id
]
}
addElement
(
elm
)
{
addElement
(
elm
)
{
this
.
elements
.
indexOf
(
elm
)
===
-
1
&&
this
.
elements
.
push
(
elm
)
}
removeElement
(
elm
)
{
removeElement
(
elm
)
{
const
elmIndex
=
this
.
elements
.
indexOf
(
elm
)
if
(
elmIndex
===
-
1
)
{
return
console
.
error
(
`removeElement[
${
elm
.
cid
}
][
${
elm
.
nid
}
] not found`
)
...
...
@@ -112,11 +112,11 @@ export class VDomSync {
this
.
elements
.
splice
(
elmIndex
,
1
)
}
push
(
type
,
cid
,
data
)
{
push
(
type
,
cid
,
data
)
{
this
.
batchData
.
push
([
type
,
[
cid
,
data
]])
}
sendPageCreate
(
data
)
{
sendPageCreate
(
data
)
{
this
.
pageCreateData
=
data
UniServiceJSBridge
.
publishHandler
(
VD_SYNC
,
{
data
:
[
...
...
@@ -128,7 +128,7 @@ export class VDomSync {
},
[
this
.
pageId
])
}
flush
()
{
flush
()
{
if
(
!
this
.
initialized
)
{
this
.
initialized
=
true
this
.
batchData
.
push
([
PAGE_CREATED
,
[
this
.
pageId
,
this
.
pagePath
]])
...
...
@@ -144,26 +144,26 @@ export class VDomSync {
}
}
restorePageCreate
()
{
restorePageCreate
()
{
this
.
batchData
.
push
([
PAGE_CREATE
,
this
.
pageCreateData
])
}
restoreMountedData
()
{
restoreMountedData
()
{
const
addMountedData
=
(
vm
)
=>
{
if
(
vm
.
_$id
)
{
this
.
push
(
MOUNTED_DATA
,
vm
.
_$id
,
vm
.
_$data
)
}
// vue 中 $children 顺序不可靠,可能存在恢复误差
//
TODO
vue 中 $children 顺序不可靠,可能存在恢复误差
vm
.
$children
.
forEach
(
childVm
=>
addMountedData
(
childVm
))
}
addMountedData
(
this
.
pageVm
)
}
restorePageCreated
()
{
restorePageCreated
()
{
this
.
batchData
.
push
([
PAGE_CREATED
,
[
this
.
pageId
,
this
.
pagePath
]])
}
restore
()
{
restore
()
{
this
.
initialized
=
true
this
.
batchData
.
length
=
0
...
...
@@ -174,7 +174,7 @@ export class VDomSync {
this
.
flush
()
}
destroy
()
{
destroy
()
{
this
.
batchData
.
length
=
0
this
.
vms
=
Object
.
create
(
null
)
this
.
initialized
=
false
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录