Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
陈庄旺
uni-app
提交
6a793afb
U
uni-app
项目概览
陈庄旺
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
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,发现更多精彩内容 >>
提交
6a793afb
编写于
7月 12, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(app): uni-app-plus
上级
7f1a8831
变更
53
展开全部
隐藏空白更改
内联
并排
Showing
53 changed file
with
451 addition
and
365 deletion
+451
-365
packages/uni-app-plus/dist/tools.umd.js
packages/uni-app-plus/dist/tools.umd.js
+2
-2
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+81
-38
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+107
-131
packages/uni-app-plus/src/service/framework/dom/Page.ts
packages/uni-app-plus/src/service/framework/dom/Page.ts
+34
-10
packages/uni-app-plus/src/service/framework/dom/decodeActions.ts
...s/uni-app-plus/src/service/framework/dom/decodeActions.ts
+2
-2
packages/uni-app-plus/src/view/framework/dom/components/UniAd.ts
...s/uni-app-plus/src/view/framework/dom/components/UniAd.ts
+3
-2
packages/uni-app-plus/src/view/framework/dom/components/UniAudio.ts
...ni-app-plus/src/view/framework/dom/components/UniAudio.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniButton.ts
...i-app-plus/src/view/framework/dom/components/UniButton.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniCanvas.ts
...i-app-plus/src/view/framework/dom/components/UniCanvas.ts
+3
-2
packages/uni-app-plus/src/view/framework/dom/components/UniCheckbox.ts
...app-plus/src/view/framework/dom/components/UniCheckbox.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniCheckboxGroup.ts
...lus/src/view/framework/dom/components/UniCheckboxGroup.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts
...pp-plus/src/view/framework/dom/components/UniComponent.ts
+46
-54
packages/uni-app-plus/src/view/framework/dom/components/UniCoverImage.ts
...p-plus/src/view/framework/dom/components/UniCoverImage.ts
+3
-2
packages/uni-app-plus/src/view/framework/dom/components/UniCoverView.ts
...pp-plus/src/view/framework/dom/components/UniCoverView.ts
+3
-2
packages/uni-app-plus/src/view/framework/dom/components/UniEditor.ts
...i-app-plus/src/view/framework/dom/components/UniEditor.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniForm.ts
...uni-app-plus/src/view/framework/dom/components/UniForm.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniIcon.ts
...uni-app-plus/src/view/framework/dom/components/UniIcon.ts
+3
-2
packages/uni-app-plus/src/view/framework/dom/components/UniImage.ts
...ni-app-plus/src/view/framework/dom/components/UniImage.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniInput.ts
...ni-app-plus/src/view/framework/dom/components/UniInput.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniLabel.ts
...ni-app-plus/src/view/framework/dom/components/UniLabel.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniMap.ts
.../uni-app-plus/src/view/framework/dom/components/UniMap.ts
+3
-2
packages/uni-app-plus/src/view/framework/dom/components/UniMovableArea.ts
...-plus/src/view/framework/dom/components/UniMovableArea.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniMovableView.ts
...-plus/src/view/framework/dom/components/UniMovableView.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniNavigator.ts
...pp-plus/src/view/framework/dom/components/UniNavigator.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniPicker.ts
...i-app-plus/src/view/framework/dom/components/UniPicker.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniPickerView.ts
...p-plus/src/view/framework/dom/components/UniPickerView.ts
+9
-3
packages/uni-app-plus/src/view/framework/dom/components/UniPickerViewColumn.ts
.../src/view/framework/dom/components/UniPickerViewColumn.ts
+3
-2
packages/uni-app-plus/src/view/framework/dom/components/UniProgress.ts
...app-plus/src/view/framework/dom/components/UniProgress.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniRadio.ts
...ni-app-plus/src/view/framework/dom/components/UniRadio.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniRadioGroup.ts
...p-plus/src/view/framework/dom/components/UniRadioGroup.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniRichText.ts
...app-plus/src/view/framework/dom/components/UniRichText.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniScrollView.ts
...p-plus/src/view/framework/dom/components/UniScrollView.ts
+9
-3
packages/uni-app-plus/src/view/framework/dom/components/UniSlider.ts
...i-app-plus/src/view/framework/dom/components/UniSlider.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniSwiper.ts
...i-app-plus/src/view/framework/dom/components/UniSwiper.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniSwiperItem.ts
...p-plus/src/view/framework/dom/components/UniSwiperItem.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniSwitch.ts
...i-app-plus/src/view/framework/dom/components/UniSwitch.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniTextarea.ts
...app-plus/src/view/framework/dom/components/UniTextarea.ts
+3
-3
packages/uni-app-plus/src/view/framework/dom/components/UniVideo.ts
...ni-app-plus/src/view/framework/dom/components/UniVideo.ts
+3
-2
packages/uni-app-plus/src/view/framework/dom/components/UniWebView.ts
...-app-plus/src/view/framework/dom/components/UniWebView.ts
+3
-2
packages/uni-app-plus/src/view/framework/dom/components/index.ts
...s/uni-app-plus/src/view/framework/dom/components/index.ts
+7
-2
packages/uni-app-plus/src/view/framework/dom/elements/UniComment.ts
...ni-app-plus/src/view/framework/dom/elements/UniComment.ts
+1
-2
packages/uni-app-plus/src/view/framework/dom/elements/UniElement.ts
...ni-app-plus/src/view/framework/dom/elements/UniElement.ts
+9
-6
packages/uni-app-plus/src/view/framework/dom/elements/UniHoverElement.ts
...p-plus/src/view/framework/dom/elements/UniHoverElement.ts
+9
-3
packages/uni-app-plus/src/view/framework/dom/elements/UniNode.ts
...s/uni-app-plus/src/view/framework/dom/elements/UniNode.ts
+6
-8
packages/uni-app-plus/src/view/framework/dom/elements/UniTextElement.ts
...pp-plus/src/view/framework/dom/elements/UniTextElement.ts
+3
-2
packages/uni-app-plus/src/view/framework/dom/elements/UniTextNode.ts
...i-app-plus/src/view/framework/dom/elements/UniTextNode.ts
+1
-2
packages/uni-app-plus/src/view/framework/dom/elements/UniViewElement.ts
...pp-plus/src/view/framework/dom/elements/UniViewElement.ts
+3
-2
packages/uni-app-plus/src/view/framework/dom/index.ts
packages/uni-app-plus/src/view/framework/dom/index.ts
+2
-2
packages/uni-app-plus/src/view/framework/dom/page.ts
packages/uni-app-plus/src/view/framework/dom/page.ts
+17
-6
packages/uni-app-plus/src/view/framework/index.ts
packages/uni-app-plus/src/view/framework/index.ts
+7
-0
packages/uni-components/src/components/label/index.tsx
packages/uni-components/src/components/label/index.tsx
+1
-1
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+1
-1
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+1
-1
未找到文件。
packages/uni-app-plus/dist/tools.umd.js
浏览文件 @
6a793afb
...
@@ -75,8 +75,8 @@
...
@@ -75,8 +75,8 @@
function
decodePageCreatedAction
([])
{
function
decodePageCreatedAction
([])
{
return
[
'
pageCreated
'
];
return
[
'
pageCreated
'
];
}
}
function
decodeCreateAction
([,
nodeId
,
nodeName
])
{
function
decodeCreateAction
([,
nodeId
,
nodeName
,
nodeJson
])
{
return
[
'
create
'
,
nodeId
,
decodeTag
(
nodeName
)];
return
[
'
create
'
,
nodeId
,
decodeTag
(
nodeName
)
,
nodeJson
];
}
}
function
decodeInsertAction
([,
...
action
])
{
function
decodeInsertAction
([,
...
action
])
{
return
[
'
insert
'
,
...
action
];
return
[
'
insert
'
,
...
action
];
...
...
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
6a793afb
...
@@ -2927,9 +2927,9 @@ var serviceContext = (function (vue) {
...
@@ -2927,9 +2927,9 @@ var serviceContext = (function (vue) {
const
ShareWithSystemOptions
=
{
const
ShareWithSystemOptions
=
{
formatArgs
:
{
formatArgs
:
{
type
(
value
,
params
)
{
type
(
value
,
params
)
{
if
(
!
TYPE
.
includes
(
value
))
if
(
value
&&
!
TYPE
.
includes
(
value
))
return
'
分享参数 type 不正确
'
;
return
'
分享参数 type 不正确
。只支持text、image
'
;
return
elemInArray
(
value
,
TYPE
);
params
.
type
=
elemInArray
(
value
,
TYPE
);
},
},
},
},
};
};
...
@@ -4507,6 +4507,7 @@ var serviceContext = (function (vue) {
...
@@ -4507,6 +4507,7 @@ var serviceContext = (function (vue) {
},
RequestProtocol
,
RequestOptions
);
},
RequestProtocol
,
RequestOptions
);
const
socketTasks
=
[];
const
socketTasks
=
[];
const
socketsMap
=
{};
const
globalEvent
=
{
const
globalEvent
=
{
open
:
''
,
open
:
''
,
close
:
''
,
close
:
''
,
...
@@ -4520,6 +4521,7 @@ var serviceContext = (function (vue) {
...
@@ -4520,6 +4521,7 @@ var serviceContext = (function (vue) {
try
{
try
{
if
(
!
socket
)
{
if
(
!
socket
)
{
socket
=
requireNativePlugin
(
'
uni-webSocket
'
);
socket
=
requireNativePlugin
(
'
uni-webSocket
'
);
bindSocketCallBack
(
socket
);
}
}
socket
.
WebSocket
({
socket
.
WebSocket
({
id
:
socketId
,
id
:
socketId
,
...
@@ -4535,6 +4537,32 @@ var serviceContext = (function (vue) {
...
@@ -4535,6 +4537,32 @@ var serviceContext = (function (vue) {
}
}
return
{
socket
,
socketId
,
errMsg
};
return
{
socket
,
socketId
,
errMsg
};
}
}
function
bindSocketCallBack
(
socket
)
{
socket
.
onopen
((
e
)
=>
{
const
curSocket
=
socketsMap
[
e
.
id
];
if
(
!
curSocket
)
return
;
curSocket
.
_socketOnOpen
();
});
socket
.
onmessage
((
e
)
=>
{
const
curSocket
=
socketsMap
[
e
.
id
];
if
(
!
curSocket
)
return
;
curSocket
.
_socketOnMessage
(
e
);
});
socket
.
onerror
((
e
)
=>
{
const
curSocket
=
socketsMap
[
e
.
id
];
if
(
!
curSocket
)
return
;
curSocket
.
_socketOnError
();
});
socket
.
onclose
((
e
)
=>
{
const
curSocket
=
socketsMap
[
e
.
id
];
if
(
!
curSocket
)
return
;
curSocket
.
_socketOnClose
();
});
}
class
SocketTask
{
class
SocketTask
{
constructor
(
socket
,
socketId
)
{
constructor
(
socket
,
socketId
)
{
this
.
id
=
socketId
;
this
.
id
=
socketId
;
...
@@ -4552,41 +4580,43 @@ var serviceContext = (function (vue) {
...
@@ -4552,41 +4580,43 @@ var serviceContext = (function (vue) {
this
.
readyState
=
this
.
CLOSED
;
this
.
readyState
=
this
.
CLOSED
;
if
(
!
this
.
_socket
)
if
(
!
this
.
_socket
)
return
;
return
;
this
.
_socket
.
onopen
(()
=>
{
}
this
.
readyState
=
this
.
OPEN
;
_socketOnOpen
()
{
this
.
socketStateChange
(
'
open
'
);
this
.
readyState
=
this
.
OPEN
;
});
this
.
socketStateChange
(
'
open
'
);
this
.
_socket
.
onmessage
((
e
)
=>
{
}
this
.
socketStateChange
(
'
message
'
,
{
_socketOnMessage
(
e
)
{
data
:
typeof
e
.
data
===
'
object
'
this
.
socketStateChange
(
'
message
'
,
{
?
base64ToArrayBuffer
(
e
.
data
.
base64
)
data
:
typeof
e
.
data
===
'
object
'
:
e
.
data
,
?
base64ToArrayBuffer
(
e
.
data
.
base64
)
});
:
e
.
data
,
});
this
.
_socket
.
onerror
(()
=>
{
this
.
socketStateChange
(
'
error
'
);
this
.
onErrorOrClose
();
});
this
.
_socket
.
onclose
(()
=>
{
this
.
socketStateChange
(
'
close
'
);
this
.
onErrorOrClose
();
});
});
}
}
_socketOnError
()
{
this
.
socketStateChange
(
'
error
'
);
this
.
onErrorOrClose
();
}
_socketOnClose
()
{
this
.
socketStateChange
(
'
close
'
);
this
.
onErrorOrClose
();
}
onErrorOrClose
()
{
onErrorOrClose
()
{
this
.
readyState
=
this
.
CLOSED
;
this
.
readyState
=
this
.
CLOSED
;
delete
socketsMap
[
this
.
id
];
const
index
=
socketTasks
.
indexOf
(
this
);
const
index
=
socketTasks
.
indexOf
(
this
);
if
(
index
>=
0
)
{
if
(
index
>=
0
)
{
socketTasks
.
splice
(
index
,
1
);
socketTasks
.
splice
(
index
,
1
);
}
}
}
}
socketStateChange
(
name
,
res
=
{})
{
socketStateChange
(
name
,
res
=
{})
{
const
data
=
name
===
'
message
'
?
res
:
{};
if
(
this
===
socketTasks
[
0
]
&&
globalEvent
[
name
])
{
if
(
this
===
socketTasks
[
0
]
&&
globalEvent
[
name
])
{
UniServiceJSBridge
.
invokeOnCallback
(
globalEvent
[
name
],
res
);
UniServiceJSBridge
.
invokeOnCallback
(
globalEvent
[
name
],
data
);
}
}
// WYQ fix: App平台修复websocket onOpen时发送数据报错的Bug
// WYQ fix: App平台修复websocket onOpen时发送数据报错的Bug
this
.
_callbacks
[
name
].
forEach
((
callback
)
=>
{
this
.
_callbacks
[
name
].
forEach
((
callback
)
=>
{
if
(
typeof
callback
===
'
function
'
)
{
if
(
typeof
callback
===
'
function
'
)
{
callback
(
name
===
'
message
'
?
res
:
{}
);
callback
(
data
);
}
}
});
});
}
}
...
@@ -4651,6 +4681,7 @@ var serviceContext = (function (vue) {
...
@@ -4651,6 +4681,7 @@ var serviceContext = (function (vue) {
}
}
else
{
else
{
socketTasks
.
push
(
socketTask
);
socketTasks
.
push
(
socketTask
);
socketsMap
[
socketId
]
=
socketTask
;
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
resolve
();
resolve
();
...
@@ -5253,10 +5284,10 @@ var serviceContext = (function (vue) {
...
@@ -5253,10 +5284,10 @@ var serviceContext = (function (vue) {
}
}
const
onInitBackgroundAudioManager
=
/*#__PURE__*/
once
(()
=>
{
const
onInitBackgroundAudioManager
=
/*#__PURE__*/
once
(()
=>
{
eventNames
.
forEach
((
item
)
=>
{
eventNames
.
forEach
((
item
)
=>
{
const
name
=
item
[
0
].
toUpperCase
()
+
item
.
substr
(
1
);
BackgroundAudioManager
.
prototype
[
`on
${
capitalize
(
item
)}
`
]
=
BackgroundAudioManager
.
prototype
[
`on
${
name
}
`
]
=
function
(
callback
)
{
function
(
callback
)
{
callbacks
[
item
].
push
(
callback
);
callbacks
[
item
].
push
(
callback
);
};
};
});
});
});
});
const
props
=
[
const
props
=
[
...
@@ -7282,6 +7313,7 @@ var serviceContext = (function (vue) {
...
@@ -7282,6 +7313,7 @@ var serviceContext = (function (vue) {
super
(
NODE_TYPE_PAGE
,
'
#page
'
,
null
);
super
(
NODE_TYPE_PAGE
,
'
#page
'
,
null
);
this
.
_id
=
1
;
this
.
_id
=
1
;
this
.
_created
=
false
;
this
.
_created
=
false
;
this
.
_createActionMap
=
new
Map
();
this
.
updateActions
=
[];
this
.
updateActions
=
[];
this
.
nodeId
=
0
;
this
.
nodeId
=
0
;
this
.
pageId
=
pageId
;
this
.
pageId
=
pageId
;
...
@@ -7327,13 +7359,29 @@ var serviceContext = (function (vue) {
...
@@ -7327,13 +7359,29 @@ var serviceContext = (function (vue) {
genId
()
{
genId
()
{
return
this
.
_id
++
;
return
this
.
_id
++
;
}
}
push
(
action
)
{
push
(
action
,
extras
)
{
if
(
this
.
isUnmounted
)
{
if
(
this
.
isUnmounted
)
{
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
console
.
log
(
formatLog
(
'
PageNode
'
,
'
push.prevent
'
,
action
));
console
.
log
(
formatLog
(
'
PageNode
'
,
'
push.prevent
'
,
action
));
}
}
return
;
return
;
}
}
switch
(
action
[
0
])
{
case
ACTION_TYPE_CREATE
:
this
.
_createActionMap
.
set
(
action
[
1
],
action
);
break
;
case
ACTION_TYPE_INSERT
:
const
createAction
=
this
.
_createActionMap
.
get
(
action
[
1
]);
if
(
createAction
)
{
createAction
[
3
]
=
extras
;
}
else
{
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
console
.
error
(
formatLog
(
`Insert`
,
action
,
'
not found createAction
'
));
}
}
break
;
}
this
.
updateActions
.
push
(
action
);
this
.
updateActions
.
push
(
action
);
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
console
.
log
(
formatLog
(
'
PageNode
'
,
'
push
'
,
action
));
console
.
log
(
formatLog
(
'
PageNode
'
,
'
push
'
,
action
));
...
@@ -7349,10 +7397,11 @@ var serviceContext = (function (vue) {
...
@@ -7349,10 +7397,11 @@ var serviceContext = (function (vue) {
this
.
send
([
this
.
createAction
]);
this
.
send
([
this
.
createAction
]);
}
}
update
()
{
update
()
{
const
{
updateActions
}
=
this
;
const
{
updateActions
,
_createActionMap
}
=
this
;
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
console
.
log
(
formatLog
(
'
PageNode
'
,
'
update
'
,
updateActions
.
length
));
console
.
log
(
formatLog
(
'
PageNode
'
,
'
update
'
,
updateActions
.
length
,
_createActionMap
.
size
));
}
}
_createActionMap
.
clear
();
// 首次
// 首次
if
(
!
this
.
_created
)
{
if
(
!
this
.
_created
)
{
this
.
_created
=
true
;
this
.
_created
=
true
;
...
@@ -7393,13 +7442,8 @@ var serviceContext = (function (vue) {
...
@@ -7393,13 +7442,8 @@ var serviceContext = (function (vue) {
pageNode
.
push
([
ACTION_TYPE_CREATE
,
nodeId
,
nodeName
]);
pageNode
.
push
([
ACTION_TYPE_CREATE
,
nodeId
,
nodeName
]);
}
}
function
pushInsertAction
(
pageNode
,
newChild
,
parentNodeId
,
refChildId
)
{
function
pushInsertAction
(
pageNode
,
newChild
,
parentNodeId
,
refChildId
)
{
pageNode
.
push
([
const
nodeJson
=
newChild
.
toJSON
({
attr
:
true
});
ACTION_TYPE_INSERT
,
pageNode
.
push
([
ACTION_TYPE_INSERT
,
newChild
.
nodeId
,
parentNodeId
,
refChildId
],
Object
.
keys
(
nodeJson
).
length
?
nodeJson
:
undefined
);
newChild
.
nodeId
,
parentNodeId
,
refChildId
,
newChild
.
toJSON
({
attr
:
true
}),
]);
}
}
function
pushRemoveAction
(
pageNode
,
nodeId
)
{
function
pushRemoveAction
(
pageNode
,
nodeId
)
{
pageNode
.
push
([
ACTION_TYPE_REMOVE
,
nodeId
]);
pageNode
.
push
([
ACTION_TYPE_REMOVE
,
nodeId
]);
...
@@ -7812,7 +7856,6 @@ var serviceContext = (function (vue) {
...
@@ -7812,7 +7856,6 @@ var serviceContext = (function (vue) {
hideKeyboard
:
hideKeyboard
,
hideKeyboard
:
hideKeyboard
,
downloadFile
:
downloadFile
,
downloadFile
:
downloadFile
,
request
:
request
,
request
:
request
,
createSocketTask
:
createSocketTask
,
connectSocket
:
connectSocket
,
connectSocket
:
connectSocket
,
sendSocketMessage
:
sendSocketMessage
,
sendSocketMessage
:
sendSocketMessage
,
closeSocket
:
closeSocket
,
closeSocket
:
closeSocket
,
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
6a793afb
此差异已折叠。
点击以展开。
packages/uni-app-plus/src/service/framework/dom/Page.ts
浏览文件 @
6a793afb
...
@@ -6,6 +6,7 @@ import {
...
@@ -6,6 +6,7 @@ import {
IUniPageNode
,
IUniPageNode
,
formatLog
,
formatLog
,
UniEvent
,
UniEvent
,
UniNodeJSON
,
}
from
'
@dcloudio/uni-shared
'
}
from
'
@dcloudio/uni-shared
'
import
{
import
{
PageCreateAction
,
PageCreateAction
,
...
@@ -20,6 +21,7 @@ import {
...
@@ -20,6 +21,7 @@ import {
ACTION_TYPE_SET_TEXT
,
ACTION_TYPE_SET_TEXT
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
ACTION_TYPE_PAGE_CREATED
,
CreateAction
,
}
from
'
../../../PageAction
'
}
from
'
../../../PageAction
'
import
{
VD_SYNC
}
from
'
../../../constants
'
import
{
VD_SYNC
}
from
'
../../../constants
'
...
@@ -29,6 +31,7 @@ export default class UniPageNode extends UniNode implements IUniPageNode {
...
@@ -29,6 +31,7 @@ export default class UniPageNode extends UniNode implements IUniPageNode {
private
_created
:
boolean
=
false
private
_created
:
boolean
=
false
private
createAction
:
PageCreateAction
private
createAction
:
PageCreateAction
private
createdAction
:
PageCreatedAction
private
createdAction
:
PageCreatedAction
private
_createActionMap
=
new
Map
<
number
,
CreateAction
>
()
public
updateActions
:
PageAction
[]
=
[]
public
updateActions
:
PageAction
[]
=
[]
public
isUnmounted
:
boolean
public
isUnmounted
:
boolean
...
@@ -98,13 +101,28 @@ export default class UniPageNode extends UniNode implements IUniPageNode {
...
@@ -98,13 +101,28 @@ export default class UniPageNode extends UniNode implements IUniPageNode {
genId
()
{
genId
()
{
return
this
.
_id
++
return
this
.
_id
++
}
}
push
(
action
:
PageAction
)
{
push
(
action
:
PageAction
,
extras
?:
unknown
)
{
if
(
this
.
isUnmounted
)
{
if
(
this
.
isUnmounted
)
{
if
(
__DEV__
)
{
if
(
__DEV__
)
{
console
.
log
(
formatLog
(
'
PageNode
'
,
'
push.prevent
'
,
action
))
console
.
log
(
formatLog
(
'
PageNode
'
,
'
push.prevent
'
,
action
))
}
}
return
return
}
}
switch
(
action
[
0
])
{
case
ACTION_TYPE_CREATE
:
this
.
_createActionMap
.
set
(
action
[
1
],
action
)
break
case
ACTION_TYPE_INSERT
:
const
createAction
=
this
.
_createActionMap
.
get
(
action
[
1
])
if
(
createAction
)
{
createAction
[
3
]
=
extras
as
UniNodeJSON
}
else
{
if
(
__DEV__
)
{
console
.
error
(
formatLog
(
`Insert`
,
action
,
'
not found createAction
'
))
}
}
break
}
this
.
updateActions
.
push
(
action
)
this
.
updateActions
.
push
(
action
)
if
(
__DEV__
)
{
if
(
__DEV__
)
{
console
.
log
(
formatLog
(
'
PageNode
'
,
'
push
'
,
action
))
console
.
log
(
formatLog
(
'
PageNode
'
,
'
push
'
,
action
))
...
@@ -120,10 +138,18 @@ export default class UniPageNode extends UniNode implements IUniPageNode {
...
@@ -120,10 +138,18 @@ export default class UniPageNode extends UniNode implements IUniPageNode {
this
.
send
([
this
.
createAction
])
this
.
send
([
this
.
createAction
])
}
}
update
()
{
update
()
{
const
{
updateActions
}
=
this
const
{
updateActions
,
_createActionMap
}
=
this
if
(
__DEV__
)
{
if
(
__DEV__
)
{
console
.
log
(
formatLog
(
'
PageNode
'
,
'
update
'
,
updateActions
.
length
))
console
.
log
(
formatLog
(
'
PageNode
'
,
'
update
'
,
updateActions
.
length
,
_createActionMap
.
size
)
)
}
}
_createActionMap
.
clear
()
// 首次
// 首次
if
(
!
this
.
_created
)
{
if
(
!
this
.
_created
)
{
this
.
_created
=
true
this
.
_created
=
true
...
@@ -175,13 +201,11 @@ function pushInsertAction(
...
@@ -175,13 +201,11 @@ function pushInsertAction(
parentNodeId
:
number
,
parentNodeId
:
number
,
refChildId
:
number
refChildId
:
number
)
{
)
{
pageNode
.
push
([
const
nodeJson
=
newChild
.
toJSON
({
attr
:
true
})
ACTION_TYPE_INSERT
,
pageNode
.
push
(
newChild
.
nodeId
!
,
[
ACTION_TYPE_INSERT
,
newChild
.
nodeId
!
,
parentNodeId
,
refChildId
],
parentNodeId
,
Object
.
keys
(
nodeJson
).
length
?
nodeJson
:
undefined
refChildId
,
)
newChild
.
toJSON
({
attr
:
true
}),
])
}
}
function
pushRemoveAction
(
pageNode
:
UniPageNode
,
nodeId
:
number
)
{
function
pushRemoveAction
(
pageNode
:
UniPageNode
,
nodeId
:
number
)
{
...
...
packages/uni-app-plus/src/service/framework/dom/decodeActions.ts
浏览文件 @
6a793afb
...
@@ -27,8 +27,8 @@ function decodePageCreatedAction([]: PageCreatedAction) {
...
@@ -27,8 +27,8 @@ function decodePageCreatedAction([]: PageCreatedAction) {
return
[
'
pageCreated
'
]
return
[
'
pageCreated
'
]
}
}
function
decodeCreateAction
([,
nodeId
,
nodeName
]:
CreateAction
)
{
function
decodeCreateAction
([,
nodeId
,
nodeName
,
nodeJson
]:
CreateAction
)
{
return
[
'
create
'
,
nodeId
,
decodeTag
(
nodeName
)]
return
[
'
create
'
,
nodeId
,
decodeTag
(
nodeName
)
,
nodeJson
]
}
}
function
decodeInsertAction
([,
...
action
]:
InsertAction
)
{
function
decodeInsertAction
([,
...
action
]:
InsertAction
)
{
...
...
packages/uni-app-plus/src/view/framework/dom/components/UniAd.ts
浏览文件 @
6a793afb
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
Ad
from
'
../../../components/ad
'
import
Ad
from
'
../../../components/ad
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniAd
extends
UniComponent
{
export
class
UniAd
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-ad
'
,
Ad
)
super
(
id
,
'
uni-ad
'
,
Ad
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniAudio.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/audio.css
'
import
'
@dcloudio/uni-components/style/audio.css
'
import
{
Audio
}
from
'
@dcloudio/uni-components
'
import
{
Audio
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniAudio
extends
UniComponent
{
export
class
UniAudio
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-audio
'
,
Audio
)
super
(
id
,
'
uni-audio
'
,
Audio
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniButton.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/button.css
'
import
'
@dcloudio/uni-components/style/button.css
'
import
{
Button
}
from
'
@dcloudio/uni-components
'
import
{
Button
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniButton
extends
UniComponent
{
export
class
UniButton
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-button
'
,
Button
)
super
(
id
,
'
uni-button
'
,
Button
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniCanvas.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/canvas.css
'
import
'
@dcloudio/uni-components/style/canvas.css
'
import
{
Canvas
}
from
'
@dcloudio/uni-components
'
import
{
Canvas
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniCanvas
extends
UniComponent
{
export
class
UniCanvas
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-canvas
'
,
Canvas
,
'
canvas > div
'
)
super
(
id
,
'
uni-canvas
'
,
Canvas
,
nodeJson
,
'
canvas > div
'
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniCheckbox.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/checkbox.css
'
import
'
@dcloudio/uni-components/style/checkbox.css
'
import
{
Checkbox
}
from
'
@dcloudio/uni-components
'
import
{
Checkbox
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniCheckbox
extends
UniComponent
{
export
class
UniCheckbox
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-checkbox
'
,
Checkbox
,
'
.uni-checkbox-wrapper
'
)
super
(
id
,
'
uni-checkbox
'
,
Checkbox
,
nodeJson
,
'
.uni-checkbox-wrapper
'
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniCheckboxGroup.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/checkbox-group.css
'
import
'
@dcloudio/uni-components/style/checkbox-group.css
'
import
{
CheckboxGroup
}
from
'
@dcloudio/uni-components
'
import
{
CheckboxGroup
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniCheckboxGroup
extends
UniComponent
{
export
class
UniCheckboxGroup
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-checkbox-group
'
,
CheckboxGroup
)
super
(
id
,
'
uni-checkbox-group
'
,
CheckboxGroup
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts
浏览文件 @
6a793afb
...
@@ -2,7 +2,7 @@ import { hasOwn } from '@vue/shared'
...
@@ -2,7 +2,7 @@ import { hasOwn } from '@vue/shared'
import
{
Component
,
createApp
,
reactive
}
from
'
vue
'
import
{
Component
,
createApp
,
reactive
}
from
'
vue
'
import
{
import
{
decodeAttr
,
decodeAttr
,
formatLog
,
//
formatLog,
parseEventName
,
parseEventName
,
UniNodeJSON
,
UniNodeJSON
,
}
from
'
@dcloudio/uni-shared
'
}
from
'
@dcloudio/uni-shared
'
...
@@ -11,48 +11,40 @@ import { createInvoker } from '../modules/events'
...
@@ -11,48 +11,40 @@ import { createInvoker } from '../modules/events'
import
{
createWrapper
}
from
'
.
'
import
{
createWrapper
}
from
'
.
'
export
class
UniComponent
extends
UniNode
{
export
class
UniComponent
extends
UniNode
{
private
$component
:
Compon
ent
declare
$
:
Elem
ent
private
$props
!
:
Record
<
string
,
any
>
private
$props
!
:
Record
<
string
,
any
>
private
$selector
?:
string
private
$holder
?:
Element
private
$holder
?:
Element
private
$fragment
:
DocumentFragment
|
null
=
null
//
private $fragment: DocumentFragment | null = null
constructor
(
constructor
(
id
:
number
,
id
:
number
,
tag
:
string
,
tag
:
string
,
component
:
Component
,
component
:
Component
,
nodeJson
:
Partial
<
UniNodeJSON
>
,
selector
?:
string
selector
?:
string
)
{
)
{
super
(
id
,
tag
)
super
(
id
,
tag
)
this
.
$component
=
component
const
container
=
document
.
createElement
(
'
div
'
)
this
.
$props
=
reactive
({})
this
.
init
(
nodeJson
)
createApp
(
createWrapper
(
component
,
this
.
$props
)).
mount
(
container
)
this
.
$
=
container
.
firstElementChild
!
if
(
selector
)
{
if
(
selector
)
{
this
.
$selector
=
selector
this
.
$holder
=
this
.
$
.
querySelector
(
selector
)
!
}
if
(
hasOwn
(
nodeJson
,
'
t
'
))
{
this
.
setText
(
nodeJson
.
t
||
''
)
}
}
}
}
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
const
container
=
document
.
createElement
(
'
div
'
)
this
.
$props
=
reactive
({})
const
{
a
}
=
nodeJson
const
{
a
}
=
nodeJson
if
(
a
)
{
if
(
a
)
{
Object
.
keys
(
a
).
forEach
((
n
)
=>
{
Object
.
keys
(
a
).
forEach
((
n
)
=>
{
this
.
setAttr
(
n
,
a
[
n
])
this
.
setAttr
(
n
,
a
[
n
])
})
})
}
}
createApp
(
createWrapper
(
this
.
$component
,
this
.
$props
)).
mount
(
container
)
}
this
.
$
=
container
.
firstElementChild
!
setText
(
text
:
string
)
{
if
(
hasOwn
(
nodeJson
,
'
t
'
))
{
;(
this
.
$holder
||
this
.
$
).
textContent
=
text
this
.
$
.
textContent
=
nodeJson
.
t
||
''
}
if
(
this
.
$selector
)
{
this
.
$holder
=
this
.
$
.
querySelector
(
this
.
$selector
)
!
}
if
(
this
.
$fragment
)
{
if
(
__DEV__
)
{
console
.
log
(
formatLog
(
this
.
tag
,
'
init
'
,
'
fragment
'
,
this
.
$fragment
))
}
;(
this
.
$holder
||
this
.
$
).
appendChild
(
this
.
$fragment
)
this
.
$fragment
=
null
}
}
}
setAttr
(
name
:
string
,
value
:
unknown
)
{
setAttr
(
name
:
string
,
value
:
unknown
)
{
const
decoded
=
decodeAttr
(
name
)
const
decoded
=
decodeAttr
(
name
)
...
@@ -69,40 +61,40 @@ export class UniComponent extends UniNode {
...
@@ -69,40 +61,40 @@ export class UniComponent extends UniNode {
removeAttr
(
name
:
string
)
{
removeAttr
(
name
:
string
)
{
this
.
$props
[
decodeAttr
(
name
)]
=
null
this
.
$props
[
decodeAttr
(
name
)]
=
null
}
}
get
fragment
()
{
//
get fragment() {
if
(
!
this
.
$fragment
)
{
//
if (!this.$fragment) {
this
.
$fragment
=
document
.
createDocumentFragment
()
//
this.$fragment = document.createDocumentFragment()
}
//
}
return
this
.
$fragment
//
return this.$fragment
}
//
}
appendChild
(
node
:
Element
)
{
appendChild
(
node
:
Element
)
{
if
(
!
this
.
$
)
{
//
if (!this.$) {
// 可能还未初始化,临时存放
//
// 可能还未初始化,临时存放
if
(
__DEV__
)
{
//
if (__DEV__) {
console
.
log
(
//
console.log(
formatLog
(
this
.
tag
,
'
fragment
'
,
'
appendChild
'
,
node
.
tagName
)
//
formatLog(this.tag, 'fragment', 'appendChild', node.tagName)
)
//
)
}
//
}
return
this
.
fragment
.
appendChild
(
node
)
//
return this.fragment.appendChild(node)
}
//
}
return
(
this
.
$holder
||
this
.
$
).
appendChild
(
node
)
return
(
this
.
$holder
||
this
.
$
).
appendChild
(
node
)
}
}
insertBefore
(
newChild
:
Node
,
refChild
:
Node
)
{
insertBefore
(
newChild
:
Node
,
refChild
:
Node
)
{
if
(
!
this
.
$
)
{
//
if (!this.$) {
// 可能还未初始化,临时存放
//
// 可能还未初始化,临时存放
if
(
__DEV__
)
{
//
if (__DEV__) {
console
.
log
(
//
console.log(
formatLog
(
//
formatLog(
this
.
tag
,
//
this.tag,
'
fragment
'
,
//
'fragment',
'
insertBefore
'
,
//
'insertBefore',
(
newChild
as
Element
).
tagName
,
//
(newChild as Element).tagName,
(
refChild
as
Element
).
tagName
//
(refChild as Element).tagName
)
//
)
)
//
)
}
//
}
return
this
.
fragment
.
insertBefore
(
newChild
,
refChild
)
//
return this.fragment.insertBefore(newChild, refChild)
}
//
}
return
(
this
.
$holder
||
this
.
$
).
insertBefore
(
newChild
,
refChild
)
return
(
this
.
$holder
||
this
.
$
).
insertBefore
(
newChild
,
refChild
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniCoverImage.ts
浏览文件 @
6a793afb
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
CoverImage
from
'
../../../components/cover-image
'
import
CoverImage
from
'
../../../components/cover-image
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniCoverImage
extends
UniComponent
{
export
class
UniCoverImage
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-cover-image
'
,
CoverImage
)
super
(
id
,
'
uni-cover-image
'
,
CoverImage
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniCoverView.ts
浏览文件 @
6a793afb
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
CoverView
from
'
../../../components/cover-view
'
import
CoverView
from
'
../../../components/cover-view
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniCoverView
extends
UniComponent
{
export
class
UniCoverView
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-cover-view
'
,
CoverView
)
super
(
id
,
'
uni-cover-view
'
,
CoverView
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniEditor.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/editor.css
'
import
'
@dcloudio/uni-components/style/editor.css
'
import
{
Editor
}
from
'
@dcloudio/uni-components
'
import
{
Editor
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniEditor
extends
UniComponent
{
export
class
UniEditor
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-editor
'
,
Editor
)
super
(
id
,
'
uni-editor
'
,
Editor
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniForm.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/form.css
'
import
'
@dcloudio/uni-components/style/form.css
'
import
{
Form
}
from
'
@dcloudio/uni-components
'
import
{
Form
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniForm
extends
UniComponent
{
export
class
UniForm
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-form
'
,
Form
,
'
span
'
)
super
(
id
,
'
uni-form
'
,
Form
,
nodeJson
,
'
span
'
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniIcon.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/icon.css
'
import
'
@dcloudio/uni-components/style/icon.css
'
import
{
Icon
}
from
'
@dcloudio/uni-components
'
import
{
Icon
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniIcon
extends
UniComponent
{
export
class
UniIcon
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-icon
'
,
Icon
)
super
(
id
,
'
uni-icon
'
,
Icon
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniImage.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/image.css
'
import
'
@dcloudio/uni-components/style/image.css
'
import
{
Image
}
from
'
@dcloudio/uni-components
'
import
{
Image
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniImage
extends
UniComponent
{
export
class
UniImage
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-image
'
,
Image
)
super
(
id
,
'
uni-image
'
,
Image
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniInput.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/input.css
'
import
'
@dcloudio/uni-components/style/input.css
'
import
{
Input
}
from
'
@dcloudio/uni-components
'
import
{
Input
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniInput
extends
UniComponent
{
export
class
UniInput
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-input
'
,
Input
)
super
(
id
,
'
uni-input
'
,
Input
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniLabel.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/label.css
'
import
'
@dcloudio/uni-components/style/label.css
'
import
{
Label
}
from
'
@dcloudio/uni-components
'
import
{
Label
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniLabel
extends
UniComponent
{
export
class
UniLabel
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-label
'
,
Label
)
super
(
id
,
'
uni-label
'
,
Label
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniMap.ts
浏览文件 @
6a793afb
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
Map
from
'
../../../components/map
'
import
Map
from
'
../../../components/map
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniMap
extends
UniComponent
{
export
class
UniMap
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-map
'
,
Map
)
super
(
id
,
'
uni-map
'
,
Map
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniMovableArea.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/movable-area.css
'
import
'
@dcloudio/uni-components/style/movable-area.css
'
import
{
MovableArea
}
from
'
@dcloudio/uni-components
'
import
{
MovableArea
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniMovableArea
extends
UniComponent
{
export
class
UniMovableArea
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-movable-area
'
,
MovableArea
)
super
(
id
,
'
uni-movable-area
'
,
MovableArea
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniMovableView.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/movable-view.css
'
import
'
@dcloudio/uni-components/style/movable-view.css
'
import
{
MovableView
}
from
'
@dcloudio/uni-components
'
import
{
MovableView
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniMovableView
extends
UniComponent
{
export
class
UniMovableView
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-movable-view
'
,
MovableView
)
super
(
id
,
'
uni-movable-view
'
,
MovableView
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniNavigator.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/navigator.css
'
import
'
@dcloudio/uni-components/style/navigator.css
'
import
{
Navigator
}
from
'
@dcloudio/uni-components
'
import
{
Navigator
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniNavigator
extends
UniComponent
{
export
class
UniNavigator
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-navigator
'
,
Navigator
)
super
(
id
,
'
uni-navigator
'
,
Navigator
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniPicker.ts
浏览文件 @
6a793afb
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
Picker
from
'
../../../components/picker
'
import
Picker
from
'
../../../components/picker
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniPicker
extends
UniComponent
{
export
class
UniPicker
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-picker
'
,
Picker
)
super
(
id
,
'
uni-picker
'
,
Picker
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniPickerView.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/picker-view.css
'
import
'
@dcloudio/uni-components/style/picker-view.css
'
import
{
PickerView
}
from
'
@dcloudio/uni-components
'
import
{
PickerView
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniPickerView
extends
UniComponent
{
export
class
UniPickerView
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-picker-view
'
,
PickerView
,
'
.uni-picker-view-wrapper
'
)
super
(
id
,
'
uni-picker-view
'
,
PickerView
,
nodeJson
,
'
.uni-picker-view-wrapper
'
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniPickerViewColumn.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/picker-view-column.css
'
import
'
@dcloudio/uni-components/style/picker-view-column.css
'
import
{
PickerViewColumn
}
from
'
@dcloudio/uni-components
'
import
{
PickerViewColumn
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniPickerViewColumn
extends
UniComponent
{
export
class
UniPickerViewColumn
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
super
(
id
,
id
,
'
uni-picker-view-column
'
,
'
uni-picker-view-column
'
,
PickerViewColumn
,
PickerViewColumn
,
nodeJson
,
'
.uni-picker-view-content
'
'
.uni-picker-view-content
'
)
)
}
}
...
...
packages/uni-app-plus/src/view/framework/dom/components/UniProgress.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/progress.css
'
import
'
@dcloudio/uni-components/style/progress.css
'
import
{
Progress
}
from
'
@dcloudio/uni-components
'
import
{
Progress
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniProgress
extends
UniComponent
{
export
class
UniProgress
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-progress
'
,
Progress
)
super
(
id
,
'
uni-progress
'
,
Progress
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniRadio.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/radio.css
'
import
'
@dcloudio/uni-components/style/radio.css
'
import
{
Radio
}
from
'
@dcloudio/uni-components
'
import
{
Radio
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniRadio
extends
UniComponent
{
export
class
UniRadio
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-radio
'
,
Radio
,
'
.uni-radio-wrapper
'
)
super
(
id
,
'
uni-radio
'
,
Radio
,
nodeJson
,
'
.uni-radio-wrapper
'
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniRadioGroup.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/radio-group.css
'
import
'
@dcloudio/uni-components/style/radio-group.css
'
import
{
RadioGroup
}
from
'
@dcloudio/uni-components
'
import
{
RadioGroup
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniRadioGroup
extends
UniComponent
{
export
class
UniRadioGroup
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-radio-group
'
,
RadioGroup
)
super
(
id
,
'
uni-radio-group
'
,
RadioGroup
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniRichText.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/rich-text.css
'
import
'
@dcloudio/uni-components/style/rich-text.css
'
import
{
RichText
}
from
'
@dcloudio/uni-components
'
import
{
RichText
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniRichText
extends
UniComponent
{
export
class
UniRichText
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-rich-text
'
,
RichText
)
super
(
id
,
'
uni-rich-text
'
,
RichText
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniScrollView.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/scroll-view.css
'
import
'
@dcloudio/uni-components/style/scroll-view.css
'
import
{
ScrollView
}
from
'
@dcloudio/uni-components
'
import
{
ScrollView
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniScrollView
extends
UniComponent
{
export
class
UniScrollView
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-scroll-view
'
,
ScrollView
,
'
.uni-scroll-view-content
'
)
super
(
id
,
'
uni-scroll-view
'
,
ScrollView
,
nodeJson
,
'
.uni-scroll-view-content
'
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniSlider.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/slider.css
'
import
'
@dcloudio/uni-components/style/slider.css
'
import
{
Slider
}
from
'
@dcloudio/uni-components
'
import
{
Slider
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniSlider
extends
UniComponent
{
export
class
UniSlider
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-slider
'
,
Slider
)
super
(
id
,
'
uni-slider
'
,
Slider
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniSwiper.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/swiper.css
'
import
'
@dcloudio/uni-components/style/swiper.css
'
import
{
Swiper
}
from
'
@dcloudio/uni-components
'
import
{
Swiper
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniSwiper
extends
UniComponent
{
export
class
UniSwiper
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-swiper
'
,
Swiper
,
'
.uni-swiper-slide-frame
'
)
super
(
id
,
'
uni-swiper
'
,
Swiper
,
nodeJson
,
'
.uni-swiper-slide-frame
'
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniSwiperItem.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/swiper-item.css
'
import
'
@dcloudio/uni-components/style/swiper-item.css
'
import
{
SwiperItem
}
from
'
@dcloudio/uni-components
'
import
{
SwiperItem
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniSwiperItem
extends
UniComponent
{
export
class
UniSwiperItem
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-swiper-item
'
,
SwiperItem
)
super
(
id
,
'
uni-swiper-item
'
,
SwiperItem
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniSwitch.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/switch.css
'
import
'
@dcloudio/uni-components/style/switch.css
'
import
{
Switch
}
from
'
@dcloudio/uni-components
'
import
{
Switch
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniSwitch
extends
UniComponent
{
export
class
UniSwitch
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-switch
'
,
Switch
)
super
(
id
,
'
uni-switch
'
,
Switch
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniTextarea.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/textarea.css
'
import
'
@dcloudio/uni-components/style/textarea.css
'
import
{
Textarea
}
from
'
@dcloudio/uni-components
'
import
{
Textarea
}
from
'
@dcloudio/uni-components
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniTextarea
extends
UniComponent
{
export
class
UniTextarea
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-textarea
'
,
Textarea
)
super
(
id
,
'
uni-textarea
'
,
Textarea
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniVideo.ts
浏览文件 @
6a793afb
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
'
../../../../../style/video.css
'
import
'
../../../../../style/video.css
'
import
Video
from
'
../../../components/video
'
import
Video
from
'
../../../components/video
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniVideo
extends
UniComponent
{
export
class
UniVideo
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-video
'
,
Video
)
super
(
id
,
'
uni-video
'
,
Video
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/UniWebView.ts
浏览文件 @
6a793afb
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
WebView
from
'
../../../components/web-view
'
import
WebView
from
'
../../../components/web-view
'
import
{
UniComponent
}
from
'
./UniComponent
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniWebView
extends
UniComponent
{
export
class
UniWebView
extends
UniComponent
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
'
uni-web-view
'
,
WebView
)
super
(
id
,
'
uni-web-view
'
,
WebView
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/components/index.ts
浏览文件 @
6a793afb
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
defineComponent
,
h
}
from
'
vue
'
import
{
defineComponent
,
h
}
from
'
vue
'
import
{
UniComment
}
from
'
../elements/UniComment
'
import
{
UniComment
}
from
'
../elements/UniComment
'
import
{
UniTextElement
}
from
'
../elements/UniTextElement
'
import
{
UniTextElement
}
from
'
../elements/UniTextElement
'
...
@@ -97,8 +98,12 @@ const BuiltInComponents = [
...
@@ -97,8 +98,12 @@ const BuiltInComponents = [
export
type
WrapperComponent
=
ReturnType
<
typeof
createWrapper
>
export
type
WrapperComponent
=
ReturnType
<
typeof
createWrapper
>
export
function
createBuiltInComponent
(
type
:
number
,
id
:
number
)
{
export
function
createBuiltInComponent
(
return
new
BuiltInComponents
[
type
]
!
(
id
)
type
:
number
,
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
return
new
BuiltInComponents
[
type
]
!
(
id
,
nodeJson
)
}
}
export
function
createWrapper
(
export
function
createWrapper
(
...
...
packages/uni-app-plus/src/view/framework/dom/elements/UniComment.ts
浏览文件 @
6a793afb
...
@@ -2,7 +2,6 @@ import { UniNode } from './UniNode'
...
@@ -2,7 +2,6 @@ import { UniNode } from './UniNode'
export
class
UniComment
extends
UniNode
{
export
class
UniComment
extends
UniNode
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
)
{
super
(
id
,
'
#comment
'
)
super
(
id
,
'
#comment
'
,
document
.
createComment
(
''
))
this
.
$
=
document
.
createComment
(
''
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/elements/UniElement.ts
浏览文件 @
6a793afb
...
@@ -9,19 +9,22 @@ import { UniCustomElement } from '../components'
...
@@ -9,19 +9,22 @@ import { UniCustomElement } from '../components'
import
{
queuePostActionJob
}
from
'
../scheduler
'
import
{
queuePostActionJob
}
from
'
../scheduler
'
export
class
UniElement
<
T
extends
object
>
extends
UniNode
{
export
class
UniElement
<
T
extends
object
>
extends
UniNode
{
$
:
UniCustomElement
declare
$
:
UniCustomElement
$props
:
T
=
reactive
({}
as
any
)
$props
:
T
=
reactive
({}
as
any
)
$propNames
:
string
[]
$propNames
:
string
[]
protected
_update
?:
Function
protected
_update
?:
Function
constructor
(
id
:
number
,
element
:
Element
,
propNames
:
string
[]
=
[])
{
constructor
(
super
(
id
,
element
.
tagName
)
id
:
number
,
this
.
$
=
element
as
UniCustomElement
element
:
Element
,
nodeJson
:
Partial
<
UniNodeJSON
>
,
propNames
:
string
[]
=
[]
)
{
super
(
id
,
element
.
tagName
,
element
)
this
.
$
.
__id
=
id
this
.
$
.
__id
=
id
this
.
$
.
__listeners
=
Object
.
create
(
null
)
this
.
$
.
__listeners
=
Object
.
create
(
null
)
this
.
$propNames
=
propNames
this
.
$propNames
=
propNames
this
.
_update
=
this
.
update
.
bind
(
this
)
this
.
_update
=
this
.
update
.
bind
(
this
)
this
.
init
(
nodeJson
)
}
}
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
if
(
hasOwn
(
nodeJson
,
'
a
'
))
{
if
(
hasOwn
(
nodeJson
,
'
a
'
))
{
...
...
packages/uni-app-plus/src/view/framework/dom/elements/UniHoverElement.ts
浏览文件 @
6a793afb
import
{
formatLog
}
from
'
@dcloudio/uni-shared
'
import
{
formatLog
,
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniCustomElement
}
from
'
../components
'
import
{
UniElement
}
from
'
./UniElement
'
import
{
UniElement
}
from
'
./UniElement
'
interface
HoverProps
{
interface
HoverProps
{
...
@@ -15,8 +16,13 @@ const PROP_NAMES_HOVER = [
...
@@ -15,8 +16,13 @@ const PROP_NAMES_HOVER = [
]
]
export
class
UniHoverElement
extends
UniElement
<
HoverProps
>
{
export
class
UniHoverElement
extends
UniElement
<
HoverProps
>
{
private
_hover
?:
Hover
private
_hover
?:
Hover
constructor
(
id
:
number
,
element
:
Element
,
propNames
:
string
[]
=
[])
{
constructor
(
super
(
id
,
element
,
[...
PROP_NAMES_HOVER
,
...
propNames
])
id
:
number
,
element
:
Element
,
nodeJson
:
Partial
<
UniNodeJSON
>
,
propNames
:
string
[]
=
[]
)
{
super
(
id
,
element
,
nodeJson
,
[...
PROP_NAMES_HOVER
,
...
propNames
])
}
}
update
()
{
update
()
{
const
hoverClass
=
this
.
$props
[
'
hover-class
'
]
const
hoverClass
=
this
.
$props
[
'
hover-class
'
]
...
...
packages/uni-app-plus/src/view/framework/dom/elements/UniNode.ts
浏览文件 @
6a793afb
...
@@ -9,9 +9,12 @@ export class UniNode {
...
@@ -9,9 +9,12 @@ export class UniNode {
$
!
:
Element
|
Text
|
Comment
$
!
:
Element
|
Text
|
Comment
isMounted
:
boolean
=
false
isMounted
:
boolean
=
false
isUnmounted
:
boolean
=
false
isUnmounted
:
boolean
=
false
constructor
(
id
:
number
,
tag
:
string
)
{
constructor
(
id
:
number
,
tag
:
string
,
element
?:
Element
|
Text
|
Comment
)
{
this
.
id
=
id
this
.
id
=
id
this
.
tag
=
tag
this
.
tag
=
tag
if
(
element
)
{
this
.
$
=
element
}
}
}
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
if
(
hasOwn
(
nodeJson
,
'
t
'
))
{
if
(
hasOwn
(
nodeJson
,
'
t
'
))
{
...
@@ -21,12 +24,7 @@ export class UniNode {
...
@@ -21,12 +24,7 @@ export class UniNode {
setText
(
text
:
string
)
{
setText
(
text
:
string
)
{
this
.
$
.
textContent
=
text
this
.
$
.
textContent
=
text
}
}
insert
(
insert
(
parentNodeId
:
number
,
refNodeId
:
number
)
{
parentNodeId
:
number
,
refNodeId
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
this
.
init
(
nodeJson
)
const
node
=
this
.
$
const
node
=
this
.
$
const
parentNode
=
$
(
parentNodeId
)
const
parentNode
=
$
(
parentNodeId
)
if
(
refNodeId
===
-
1
)
{
if
(
refNodeId
===
-
1
)
{
...
@@ -41,7 +39,7 @@ export class UniNode {
...
@@ -41,7 +39,7 @@ export class UniNode {
$
.
parentNode
!
.
removeChild
(
$
)
$
.
parentNode
!
.
removeChild
(
$
)
this
.
isUnmounted
=
false
this
.
isUnmounted
=
false
}
}
appendChild
(
node
:
Element
)
{
appendChild
(
node
:
Node
)
{
return
this
.
$
.
appendChild
(
node
)
return
this
.
$
.
appendChild
(
node
)
}
}
insertBefore
(
newChild
:
Node
,
refChild
:
Node
)
{
insertBefore
(
newChild
:
Node
,
refChild
:
Node
)
{
...
...
packages/uni-app-plus/src/view/framework/dom/elements/UniTextElement.ts
浏览文件 @
6a793afb
...
@@ -13,9 +13,10 @@ const PROP_NAMES_HOVER = ['space', 'decode']
...
@@ -13,9 +13,10 @@ const PROP_NAMES_HOVER = ['space', 'decode']
export
class
UniTextElement
extends
UniElement
<
TextProps
>
{
export
class
UniTextElement
extends
UniElement
<
TextProps
>
{
private
_text
:
string
=
''
private
_text
:
string
=
''
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
document
.
createElement
(
'
uni-text
'
),
PROP_NAMES_HOVER
)
super
(
id
,
document
.
createElement
(
'
uni-text
'
),
nodeJson
,
PROP_NAMES_HOVER
)
}
}
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
this
.
_text
=
nodeJson
.
t
||
''
this
.
_text
=
nodeJson
.
t
||
''
super
.
init
(
nodeJson
)
super
.
init
(
nodeJson
)
...
...
packages/uni-app-plus/src/view/framework/dom/elements/UniTextNode.ts
浏览文件 @
6a793afb
...
@@ -2,7 +2,6 @@ import { UniNode } from './UniNode'
...
@@ -2,7 +2,6 @@ import { UniNode } from './UniNode'
export
class
UniTextNode
extends
UniNode
{
export
class
UniTextNode
extends
UniNode
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
)
{
super
(
id
,
'
#text
'
)
super
(
id
,
'
#text
'
,
document
.
createTextNode
(
''
))
this
.
$
=
document
.
createTextNode
(
''
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/elements/UniViewElement.ts
浏览文件 @
6a793afb
import
'
@dcloudio/uni-components/style/view.css
'
import
'
@dcloudio/uni-components/style/view.css
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniHoverElement
}
from
'
./UniHoverElement
'
import
{
UniHoverElement
}
from
'
./UniHoverElement
'
export
class
UniViewElement
extends
UniHoverElement
{
export
class
UniViewElement
extends
UniHoverElement
{
constructor
(
id
:
number
)
{
constructor
(
id
:
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
(
id
,
document
.
createElement
(
'
uni-view
'
))
super
(
id
,
document
.
createElement
(
'
uni-view
'
)
,
nodeJson
)
}
}
}
}
packages/uni-app-plus/src/view/framework/dom/index.ts
浏览文件 @
6a793afb
...
@@ -20,9 +20,9 @@ export function onVdSync(actions: PageAction[]) {
...
@@ -20,9 +20,9 @@ export function onVdSync(actions: PageAction[]) {
case
ACTION_TYPE_PAGE_CREATED
:
case
ACTION_TYPE_PAGE_CREATED
:
return
onPageCreated
()
return
onPageCreated
()
case
ACTION_TYPE_CREATE
:
case
ACTION_TYPE_CREATE
:
return
createElement
(
action
[
1
],
action
[
2
])
return
createElement
(
action
[
1
],
action
[
2
]
,
action
[
3
]
)
case
ACTION_TYPE_INSERT
:
case
ACTION_TYPE_INSERT
:
return
$
(
action
[
1
]).
insert
(
action
[
2
],
action
[
3
]
,
action
[
4
]
)
return
$
(
action
[
1
]).
insert
(
action
[
2
],
action
[
3
])
case
ACTION_TYPE_REMOVE
:
case
ACTION_TYPE_REMOVE
:
return
$
(
action
[
1
]).
remove
()
return
$
(
action
[
1
]).
remove
()
case
ACTION_TYPE_SET_ATTRIBUTE
:
case
ACTION_TYPE_SET_ATTRIBUTE
:
...
...
packages/uni-app-plus/src/view/framework/dom/page.ts
浏览文件 @
6a793afb
...
@@ -5,7 +5,7 @@ import {
...
@@ -5,7 +5,7 @@ import {
disableScrollListener
,
disableScrollListener
,
updateCssVar
,
updateCssVar
,
}
from
'
@dcloudio/uni-core
'
}
from
'
@dcloudio/uni-core
'
import
{
formatLog
}
from
'
@dcloudio/uni-shared
'
import
{
formatLog
,
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
PageCreateData
}
from
'
../../../PageAction
'
import
{
PageCreateData
}
from
'
../../../PageAction
'
import
{
createBuiltInComponent
}
from
'
./components
'
import
{
createBuiltInComponent
}
from
'
./components
'
...
@@ -19,12 +19,23 @@ export function $(id: number) {
...
@@ -19,12 +19,23 @@ export function $(id: number) {
return
elements
.
get
(
id
)
as
UniElement
<
any
>
return
elements
.
get
(
id
)
as
UniElement
<
any
>
}
}
export
function
createElement
(
id
:
number
,
tag
:
string
|
number
)
{
export
function
createElement
(
id
:
number
,
tag
:
string
|
number
,
nodeJson
:
Partial
<
UniNodeJSON
>
=
{}
)
{
let
element
:
UniNode
let
element
:
UniNode
if
(
isString
(
tag
))
{
if
(
id
===
0
)
{
element
=
new
UniElement
(
id
,
document
.
createElement
(
tag
))
// initPageElement
element
=
new
UniNode
(
id
,
tag
as
string
,
document
.
createElement
(
tag
as
string
)
)
}
else
if
(
isString
(
tag
))
{
element
=
new
UniElement
(
id
,
document
.
createElement
(
tag
),
nodeJson
)
}
else
{
}
else
{
element
=
createBuiltInComponent
(
tag
,
id
)
element
=
createBuiltInComponent
(
tag
,
id
,
nodeJson
)
}
}
elements
.
set
(
id
,
element
)
elements
.
set
(
id
,
element
)
return
element
return
element
...
@@ -80,7 +91,7 @@ function initSystemInfo(
...
@@ -80,7 +91,7 @@ function initSystemInfo(
}
}
function
initPageElement
()
{
function
initPageElement
()
{
createElement
(
0
,
'
div
'
).
$
=
document
.
getElementById
(
'
app
'
)
!
createElement
(
0
,
'
div
'
,
{}
).
$
=
document
.
getElementById
(
'
app
'
)
!
}
}
function
initPageCss
(
route
:
string
)
{
function
initPageCss
(
route
:
string
)
{
...
...
packages/uni-app-plus/src/view/framework/index.ts
0 → 100644
浏览文件 @
6a793afb
import
{
initSubscribeHandlers
}
from
'
./subscriber
'
import
{
preventDoubleTap
}
from
'
./gesture
'
export
function
initView
()
{
initSubscribeHandlers
()
preventDoubleTap
()
}
packages/uni-components/src/components/label/index.tsx
浏览文件 @
6a793afb
...
@@ -44,7 +44,7 @@ export default /*#__PURE__*/ defineBuiltInComponent({
...
@@ -44,7 +44,7 @@ export default /*#__PURE__*/ defineBuiltInComponent({
true
true
)
)
}
else
{
}
else
{
if
(
typeof
handlers
[
0
]
===
'
function
'
)
handlers
[
0
](
$event
,
true
)
handlers
.
length
&&
handlers
[
0
](
$event
,
true
)
}
}
})
})
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
6a793afb
...
@@ -903,7 +903,7 @@ var index$x = /* @__PURE__ */ defineBuiltInComponent({
...
@@ -903,7 +903,7 @@ var index$x = /* @__PURE__ */ defineBuiltInComponent({
if
(
props2
.
for
)
{
if
(
props2
.
for
)
{
UniViewJSBridge
.
emit
(
"
uni-label-click-
"
+
pageId
+
"
-
"
+
props2
.
for
,
$event
,
true
);
UniViewJSBridge
.
emit
(
"
uni-label-click-
"
+
pageId
+
"
-
"
+
props2
.
for
,
$event
,
true
);
}
else
{
}
else
{
handlers
[
0
](
$event
,
true
);
handlers
.
length
&&
handlers
[
0
](
$event
,
true
);
}
}
});
});
return
()
=>
vue
.
createVNode
(
"
uni-label
"
,
{
return
()
=>
vue
.
createVNode
(
"
uni-label
"
,
{
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
6a793afb
...
@@ -1717,7 +1717,7 @@ var index$t = /* @__PURE__ */ defineBuiltInComponent({
...
@@ -1717,7 +1717,7 @@ var index$t = /* @__PURE__ */ defineBuiltInComponent({
if (props2.for) {
if (props2.for) {
UniViewJSBridge.emit("uni-label-click-" + pageId + "-" + props2.for, $event, true);
UniViewJSBridge.emit("uni-label-click-" + pageId + "-" + props2.for, $event, true);
} else {
} else {
handlers[0]($event, true);
handlers
.length && handlers
[0]($event, true);
}
}
});
});
return () => createVNode("uni-label", {
return () => createVNode("uni-label", {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录