Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
35b26f8f
U
uni-app
项目概览
DCloud
/
uni-app
14 天 前同步成功
通知
751
Star
38709
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
8
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
8
Issue
8
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
35b26f8f
编写于
10月 10, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(app): do not trigger onRemoveChild when insertBefore (question/154836)
上级
1fe9adeb
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
70 addition
and
24 deletion
+70
-24
packages/uni-app-plus/dist/tools.umd.js
packages/uni-app-plus/dist/tools.umd.js
+29
-8
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+1
-1
packages/uni-app-plus/src/view/framework/dom/decodeActions.ts
...ages/uni-app-plus/src/view/framework/dom/decodeActions.ts
+19
-12
packages/uni-shared/dist/uni-shared.cjs.js
packages/uni-shared/dist/uni-shared.cjs.js
+7
-1
packages/uni-shared/dist/uni-shared.es.js
packages/uni-shared/dist/uni-shared.es.js
+7
-1
packages/uni-shared/src/vdom/Node.ts
packages/uni-shared/src/vdom/Node.ts
+7
-1
未找到文件。
packages/uni-app-plus/dist/tools.umd.js
浏览文件 @
35b26f8f
...
...
@@ -4,6 +4,21 @@
(
global
=
typeof
globalThis
!==
'
undefined
'
?
globalThis
:
global
||
self
,
factory
(
global
.
Tools
=
{}));
})(
this
,
(
function
(
exports
)
{
'
use strict
'
;
/**
* Make a map and return a function for checking if a key
* is in that map.
* IMPORTANT: all calls of this function must be prefixed with
* \/\*#\_\_PURE\_\_\*\/
* So that rollup can tree-shake them if necessary.
*/
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
?
Object
.
freeze
({})
:
{};
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
?
Object
.
freeze
([])
:
[];
const
hasOwnProperty
=
Object
.
prototype
.
hasOwnProperty
;
const
hasOwn
=
(
val
,
key
)
=>
hasOwnProperty
.
call
(
val
,
key
);
const
ACTION_TYPE_PAGE_CREATE
=
1
;
const
ACTION_TYPE_PAGE_CREATED
=
2
;
const
ACTION_TYPE_CREATE
=
3
;
...
...
@@ -56,7 +71,7 @@
case
ACTION_TYPE_CREATE
:
return
decodeCreateAction
(
action
,
getDict
);
case
ACTION_TYPE_INSERT
:
return
decodeInsertAction
(
action
);
return
decodeInsertAction
(
action
,
getDict
);
case
ACTION_TYPE_REMOVE
:
return
decodeRemoveAction
(
action
);
case
ACTION_TYPE_SET_ATTRIBUTE
:
...
...
@@ -84,19 +99,19 @@
if
(
!
nodeJson
)
{
return
;
}
if
(
nodeJson
.
a
)
{
if
(
hasOwn
(
nodeJson
,
'
a
'
)
)
{
nodeJson
.
a
=
getDict
(
nodeJson
.
a
);
}
if
(
nodeJson
.
e
)
{
if
(
hasOwn
(
nodeJson
,
'
e
'
)
)
{
nodeJson
.
e
=
getDict
(
nodeJson
.
e
,
false
);
}
if
(
nodeJson
.
w
)
{
if
(
hasOwn
(
nodeJson
,
'
w
'
)
)
{
nodeJson
.
w
=
getWxsEventDict
(
nodeJson
.
w
,
getDict
);
}
if
(
nodeJson
.
s
)
{
if
(
hasOwn
(
nodeJson
,
'
s
'
)
)
{
nodeJson
.
s
=
getDict
(
nodeJson
.
s
);
}
if
(
nodeJson
.
t
)
{
if
(
hasOwn
(
nodeJson
,
'
t
'
)
)
{
nodeJson
.
t
=
getDict
(
nodeJson
.
t
);
}
return
nodeJson
;
...
...
@@ -118,8 +133,14 @@
decodeNodeJson
(
getDict
,
nodeJson
),
];
}
function
decodeInsertAction
([,
...
action
])
{
return
[
'
insert
'
,
...
action
];
function
decodeInsertAction
([,
...
action
],
getDict
)
{
return
[
'
insert
'
,
action
[
0
],
action
[
1
],
action
[
2
],
action
[
3
]
?
decodeNodeJson
(
getDict
,
action
[
3
])
:
{},
];
}
function
decodeRemoveAction
([,
...
action
])
{
return
[
'
remove
'
,
...
action
];
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
35b26f8f
此差异已折叠。
点击以展开。
packages/uni-app-plus/src/view/framework/dom/decodeActions.ts
浏览文件 @
35b26f8f
import
{
hasOwn
}
from
'
@vue/shared
'
import
{
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_ADD_WXS_EVENT
,
...
...
@@ -77,7 +78,7 @@ export function decodeActions(actions: (PageAction | DictAction)[]) {
case
ACTION_TYPE_CREATE
:
return
decodeCreateAction
(
action
,
getDict
)
case
ACTION_TYPE_INSERT
:
return
decodeInsertAction
(
action
)
return
decodeInsertAction
(
action
,
getDict
)
case
ACTION_TYPE_REMOVE
:
return
decodeRemoveAction
(
action
)
case
ACTION_TYPE_SET_ATTRIBUTE
:
...
...
@@ -111,31 +112,31 @@ export function decodeNodeJson(
if
(
!
nodeJson
)
{
return
}
if
(
nodeJson
.
a
)
{
;(
nodeJson
as
unknown
as
UniNodeJSON
).
a
=
getDict
(
nodeJson
.
a
)
as
Record
<
if
(
hasOwn
(
nodeJson
,
'
a
'
)
)
{
;(
nodeJson
as
unknown
as
UniNodeJSON
).
a
=
getDict
(
nodeJson
.
a
!
)
as
Record
<
string
,
unknown
>
}
if
(
nodeJson
.
e
)
{
if
(
hasOwn
(
nodeJson
,
'
e
'
)
)
{
;(
nodeJson
as
unknown
as
UniNodeJSON
).
e
=
getDict
(
nodeJson
.
e
,
nodeJson
.
e
!
,
false
)
as
Record
<
string
,
number
>
}
if
(
nodeJson
.
w
)
{
if
(
hasOwn
(
nodeJson
,
'
w
'
)
)
{
;(
nodeJson
as
unknown
as
UniNodeJSON
).
w
=
getWxsEventDict
(
nodeJson
.
w
,
nodeJson
.
w
!
,
getDict
)
}
if
(
nodeJson
.
s
)
{
if
(
hasOwn
(
nodeJson
,
'
s
'
)
)
{
;(
nodeJson
as
unknown
as
UniNodeJSON
).
s
=
getDict
(
nodeJson
.
s
as
[
number
,
number
][]
)
as
UniCSSStyleDeclarationJSON
}
if
(
nodeJson
.
t
)
{
;(
nodeJson
as
unknown
as
UniNodeJSON
).
t
=
getDict
(
nodeJson
.
t
)
as
string
if
(
hasOwn
(
nodeJson
,
'
t
'
)
)
{
;(
nodeJson
as
unknown
as
UniNodeJSON
).
t
=
getDict
(
nodeJson
.
t
!
)
as
string
}
return
nodeJson
as
unknown
as
UniNodeJSON
}
...
...
@@ -162,8 +163,14 @@ function decodeCreateAction(
]
}
function
decodeInsertAction
([,
...
action
]:
InsertAction
)
{
return
[
'
insert
'
,
...
action
]
function
decodeInsertAction
([,
...
action
]:
InsertAction
,
getDict
:
GetDict
)
{
return
[
'
insert
'
,
action
[
0
],
action
[
1
],
action
[
2
],
action
[
3
]
?
decodeNodeJson
(
getDict
,
action
[
3
]
as
UniNodeJSONMinify
)
:
{},
]
}
function
decodeRemoveAction
([,
...
action
]:
RemoveAction
)
{
...
...
packages/uni-shared/dist/uni-shared.cjs.js
浏览文件 @
35b26f8f
...
...
@@ -818,7 +818,12 @@ function sibling(node, type) {
function
removeNode
(
node
)
{
const
{
parentNode
}
=
node
;
if
(
parentNode
)
{
parentNode
.
removeChild
(
node
);
const
{
childNodes
}
=
parentNode
;
const
index
=
childNodes
.
indexOf
(
node
);
if
(
index
>
-
1
)
{
node
.
parentNode
=
null
;
childNodes
.
splice
(
index
,
1
);
}
}
}
function
checkNodeId
(
node
)
{
...
...
@@ -894,6 +899,7 @@ class UniNode extends UniEventTarget {
return
cloned
;
}
insertBefore
(
newChild
,
refChild
)
{
// 先从现在的父节点移除(注意:不能触发onRemoveChild,否则会生成先remove该 id,再 insert)
removeNode
(
newChild
);
newChild
.
pageNode
=
this
.
pageNode
;
newChild
.
parentNode
=
this
;
...
...
packages/uni-shared/dist/uni-shared.es.js
浏览文件 @
35b26f8f
...
...
@@ -814,7 +814,12 @@ function sibling(node, type) {
function
removeNode
(
node
)
{
const
{
parentNode
}
=
node
;
if
(
parentNode
)
{
parentNode
.
removeChild
(
node
);
const
{
childNodes
}
=
parentNode
;
const
index
=
childNodes
.
indexOf
(
node
);
if
(
index
>
-
1
)
{
node
.
parentNode
=
null
;
childNodes
.
splice
(
index
,
1
);
}
}
}
function
checkNodeId
(
node
)
{
...
...
@@ -890,6 +895,7 @@ class UniNode extends UniEventTarget {
return
cloned
;
}
insertBefore
(
newChild
,
refChild
)
{
// 先从现在的父节点移除(注意:不能触发onRemoveChild,否则会生成先remove该 id,再 insert)
removeNode
(
newChild
);
newChild
.
pageNode
=
this
.
pageNode
;
newChild
.
parentNode
=
this
;
...
...
packages/uni-shared/src/vdom/Node.ts
浏览文件 @
35b26f8f
...
...
@@ -30,7 +30,12 @@ function sibling(node: UniNode, type: 'n' | 'p') {
function
removeNode
(
node
:
UniNode
)
{
const
{
parentNode
}
=
node
if
(
parentNode
)
{
parentNode
.
removeChild
(
node
)
const
{
childNodes
}
=
parentNode
const
index
=
childNodes
.
indexOf
(
node
)
if
(
index
>
-
1
)
{
node
.
parentNode
=
null
childNodes
.
splice
(
index
,
1
)
}
}
}
...
...
@@ -169,6 +174,7 @@ export class UniNode extends UniEventTarget {
}
insertBefore
(
newChild
:
UniNode
,
refChild
:
UniNode
|
null
):
UniNode
{
// 先从现在的父节点移除(注意:不能触发onRemoveChild,否则会生成先remove该 id,再 insert)
removeNode
(
newChild
)
newChild
.
pageNode
=
this
.
pageNode
newChild
.
parentNode
=
this
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录