Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
genary
uni-app
提交
98c9007d
U
uni-app
项目概览
genary
/
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,发现更多精彩内容 >>
提交
98c9007d
编写于
2月 25, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(app): insert with node json
上级
4ce481b4
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
57 addition
and
20 deletion
+57
-20
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+7
-2
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+3
-3
packages/uni-app-plus/src/service/framework/dom/Page.ts
packages/uni-app-plus/src/service/framework/dom/Page.ts
+3
-0
packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts
...pp-plus/src/view/framework/dom/components/UniComponent.ts
+1
-1
packages/uni-app-plus/src/view/framework/dom/elements/UniElement.ts
...ni-app-plus/src/view/framework/dom/elements/UniElement.ts
+12
-9
packages/uni-app-plus/src/view/framework/dom/elements/UniNode.ts
...s/uni-app-plus/src/view/framework/dom/elements/UniNode.ts
+10
-2
packages/uni-app-plus/src/view/framework/dom/index.ts
packages/uni-app-plus/src/view/framework/dom/index.ts
+5
-1
packages/uni-shared/dist/uni-shared.d.ts
packages/uni-shared/dist/uni-shared.d.ts
+8
-1
packages/uni-shared/src/vdom/Action.ts
packages/uni-shared/src/vdom/Action.ts
+8
-1
未找到文件。
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
98c9007d
...
...
@@ -18708,9 +18708,14 @@ var serviceContext = (function (vue) {
}
}
else {
if ((process.env.NODE_ENV !== 'production')) {
console.error(formatLog(`Insert`, action, 'not found createAction'));
// 部分手机上,create 和 insert 可能不在同一批次,被分批发送
if (extras) {
action[4] = extras;
}
this.updateActions.push(action);
// if ((process.env.NODE_ENV !== 'production')) {
// console.error(formatLog(`Insert`, action, 'not found createAction'))
// }
}
break;
}
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
98c9007d
此差异已折叠。
点击以展开。
packages/uni-app-plus/src/service/framework/dom/Page.ts
浏览文件 @
98c9007d
...
...
@@ -213,6 +213,9 @@ export default class UniPageNode extends UniNode implements IUniPageNode {
}
}
else
{
// 部分手机上,create 和 insert 可能不在同一批次,被分批发送
if
(
extras
)
{
action
[
4
]
=
extras
as
UniNodeJSON
}
this
.
updateActions
.
push
(
action
)
// if (__DEV__) {
// console.error(formatLog(`Insert`, action, 'not found createAction'))
...
...
packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts
浏览文件 @
98c9007d
...
...
@@ -71,7 +71,7 @@ export class UniComponent extends UniNode {
// 延迟到insert之后,再flush,确保mounted等生命周期触发正常
flushPostFlushCbs
()
}
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
,
isCreate
:
boolean
=
true
)
{
const
{
a
,
e
,
w
}
=
nodeJson
if
(
a
)
{
// 初始化时,先提取 wxsProps,再 setAttr
...
...
packages/uni-app-plus/src/view/framework/dom/elements/UniElement.ts
浏览文件 @
98c9007d
...
...
@@ -45,7 +45,7 @@ export class UniElement<T extends object> extends UniNode {
this
.
init
(
nodeJson
)
this
.
insert
(
parentNodeId
,
refNodeId
)
}
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
,
isCreate
:
boolean
=
true
)
{
if
(
hasOwn
(
nodeJson
,
'
a
'
))
{
this
.
setAttrs
(
nodeJson
.
a
!
)
}
...
...
@@ -59,14 +59,17 @@ export class UniElement<T extends object> extends UniNode {
this
.
addWxsEvents
(
nodeJson
.
w
!
)
}
super
.
init
(
nodeJson
)
watch
(
this
.
$props
,
()
=>
{
queuePostActionJob
(
this
.
_update
!
,
JOB_PRIORITY_UPDATE
)
},
{
flush
:
'
sync
'
}
)
this
.
update
(
true
)
// insert 的时候可能也会调用该 init
if
(
isCreate
)
{
watch
(
this
.
$props
,
()
=>
{
queuePostActionJob
(
this
.
_update
!
,
JOB_PRIORITY_UPDATE
)
},
{
flush
:
'
sync
'
}
)
this
.
update
(
true
)
}
}
setAttrs
(
attrs
:
Record
<
string
,
any
>
)
{
// 初始化时,先提取 wxsProps,再 setAttr
...
...
packages/uni-app-plus/src/view/framework/dom/elements/UniNode.ts
浏览文件 @
98c9007d
...
...
@@ -36,7 +36,7 @@ export class UniNode {
parent
.
appendUniChild
(
this
)
}
}
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
,
isCreate
:
boolean
=
true
)
{
if
(
hasOwn
(
nodeJson
,
'
t
'
))
{
this
.
$
.
textContent
=
nodeJson
.
t
as
string
}
...
...
@@ -44,7 +44,15 @@ export class UniNode {
setText
(
text
:
string
)
{
this
.
$
.
textContent
=
text
}
insert
(
parentNodeId
:
number
,
refNodeId
:
number
)
{
insert
(
parentNodeId
:
number
,
refNodeId
:
number
,
nodeJson
?:
Partial
<
UniNodeJSON
>
)
{
// 部分性能低的手机,create 和 insert 是分开的,而 nodeJson 可能随着 insert
if
(
nodeJson
)
{
this
.
init
(
nodeJson
,
false
)
}
const
node
=
this
.
$
const
parentNode
=
$
(
parentNodeId
)
if
(
refNodeId
===
-
1
)
{
...
...
packages/uni-app-plus/src/view/framework/dom/index.ts
浏览文件 @
98c9007d
...
...
@@ -68,7 +68,11 @@ function onPageUpdateSync(actions: (PageAction | DictAction)[]) {
decodeNodeJson
(
getDict
,
action
[
5
]
as
UniNodeJSONMinify
)
)
case
ACTION_TYPE_INSERT
:
return
$
(
action
[
1
]).
insert
(
action
[
2
],
action
[
3
])
return
$
(
action
[
1
]).
insert
(
action
[
2
],
action
[
3
],
decodeNodeJson
(
getDict
,
action
[
4
]
as
UniNodeJSONMinify
)
)
case
ACTION_TYPE_REMOVE
:
return
$
(
action
[
1
]).
remove
()
case
ACTION_TYPE_SET_ATTRIBUTE
:
...
...
packages/uni-shared/dist/uni-shared.d.ts
浏览文件 @
98c9007d
...
...
@@ -240,8 +240,15 @@ export declare const initCustomDatasetOnce: () => void;
* nodeId
* parentNodeId
* refNodeId
* nodeJson
*/
export
declare
type
InsertAction
=
[
typeof
ACTION_TYPE_INSERT
,
number
,
number
,
number
];
export
declare
type
InsertAction
=
[
typeof
ACTION_TYPE_INSERT
,
number
,
number
,
number
,
Partial
<
UniNodeJSON
|
UniNodeJSONMinify
>
?
];
export
declare
const
invokeArrayFns
:
(
fns
:
Function
[],
arg
?:
any
)
=>
any
;
...
...
packages/uni-shared/src/vdom/Action.ts
浏览文件 @
98c9007d
...
...
@@ -58,8 +58,15 @@ export type CreateAction = [
* nodeId
* parentNodeId
* refNodeId
* nodeJson
*/
export
type
InsertAction
=
[
typeof
ACTION_TYPE_INSERT
,
number
,
number
,
number
]
export
type
InsertAction
=
[
typeof
ACTION_TYPE_INSERT
,
number
,
number
,
number
,
Partial
<
UniNodeJSON
|
UniNodeJSONMinify
>
?
]
/**
* nodeId
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录