Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
陈庄旺
uni-app
提交
e9058f15
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,发现更多精彩内容 >>
提交
e9058f15
编写于
7月 09, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(app): uni-app-plus
上级
f17e1c0f
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
103 addition
and
81 deletion
+103
-81
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+13
-24
packages/uni-app-plus/src/PageAction.ts
packages/uni-app-plus/src/PageAction.ts
+1
-1
packages/uni-app-plus/src/view/framework/dom/components/UniButton.ts
...i-app-plus/src/view/framework/dom/components/UniButton.ts
+10
-0
packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts
...pp-plus/src/view/framework/dom/components/UniComponent.ts
+12
-23
packages/uni-app-plus/src/view/framework/dom/components/index.ts
...s/uni-app-plus/src/view/framework/dom/components/index.ts
+35
-0
packages/uni-app-plus/src/view/framework/dom/elements/UniElement.ts
...ni-app-plus/src/view/framework/dom/elements/UniElement.ts
+4
-4
packages/uni-app-plus/src/view/framework/dom/elements/UniNode.ts
...s/uni-app-plus/src/view/framework/dom/elements/UniNode.ts
+1
-1
packages/uni-app-plus/src/view/framework/dom/elements/index.ts
...ges/uni-app-plus/src/view/framework/dom/elements/index.ts
+0
-22
packages/uni-app-plus/src/view/framework/dom/index.ts
packages/uni-app-plus/src/view/framework/dom/index.ts
+1
-2
packages/uni-app-plus/src/view/framework/dom/modules/class.ts
...ages/uni-app-plus/src/view/framework/dom/modules/class.ts
+0
-0
packages/uni-app-plus/src/view/framework/dom/modules/events.ts
...ges/uni-app-plus/src/view/framework/dom/modules/events.ts
+2
-2
packages/uni-app-plus/src/view/framework/dom/modules/style.ts
...ages/uni-app-plus/src/view/framework/dom/modules/style.ts
+0
-0
packages/uni-app-plus/src/view/framework/dom/page.ts
packages/uni-app-plus/src/view/framework/dom/page.ts
+23
-1
packages/vite-plugin-uni/package.json
packages/vite-plugin-uni/package.json
+1
-1
未找到文件。
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
e9058f15
...
...
@@ -5950,10 +5950,10 @@
};
}
});
c
onst
UniButton
=
createWrapper
(
Button
);
class
UniButtonElement
extends
UniNode
{
constructor
(
id
)
{
super
(
id
,
"
uni-button
"
)
;
c
lass
UniComponent
extends
UniNode
{
constructor
(
id
,
tag
,
component
)
{
super
(
id
,
tag
);
this
.
$component
=
component
;
}
init
(
nodeJson
)
{
const
container
=
document
.
createElement
(
"
div
"
);
...
...
@@ -5964,17 +5964,11 @@
this
.
setAttr
(
n
,
a
[
n
]);
});
}
c
onst
vm
=
createApp
(
UniButton
,
{
attrs
:
this
.
$props
}
).
mount
(
container
);
c
reateApp
(
createWrapper
(
this
.
$component
,
this
.
$props
)
).
mount
(
container
);
this
.
$
=
container
.
firstElementChild
;
if
(
hasOwn$1
(
nodeJson
,
"
t
"
))
{
this
.
$
.
textContent
=
nodeJson
.
t
||
""
;
}
watch
(
this
.
$props
,
()
=>
{
{
console
.
log
(
formatLog
(
this
.
tag
,
"
props
"
,
"
forceUpdate
"
));
}
vm
.
$forceUpdate
();
});
}
setAttr
(
name
,
value
)
{
const
decoded
=
decodeAttr
(
name
);
...
...
@@ -5988,6 +5982,11 @@
this
.
$props
[
decodeAttr
(
name
)]
=
null
;
}
}
class
UniButton
extends
UniComponent
{
constructor
(
id
)
{
super
(
id
,
"
uni-button
"
,
Button
);
}
}
const
BuiltInComponents
=
[
,
UniViewElement
,
...
...
@@ -5997,23 +5996,13 @@
UniComment
,
,
,
UniButton
Element
UniButton
];
function
createBuiltInComponent
(
type
,
id
)
{
return
new
BuiltInComponents
[
type
](
id
);
}
function
createWrapper
(
component
)
{
return
defineComponent
({
props
:
[
"
attrs
"
],
data
()
{
return
{
props
:
this
.
attrs
};
},
render
()
{
return
h
(
component
,
this
.
props
);
}
});
function
createWrapper
(
component
,
props
)
{
return
()
=>
h
(
component
,
props
);
}
const
elements
=
new
Map
();
function
$
(
id
)
{
...
...
packages/uni-app-plus/src/PageAction.ts
浏览文件 @
e9058f15
import
{
onNodeEvent
}
from
'
./service/framework/dom/onNodeEvent
'
import
{
createElement
}
from
'
./view/framework/dom/
elements
'
import
{
createElement
}
from
'
./view/framework/dom/
page
'
import
{
UniElement
}
from
'
./view/framework/dom/elements/UniElement
'
export
const
ACTION_TYPE_PAGE_CREATE
=
1
...
...
packages/uni-app-plus/src/view/framework/dom/components/UniButton.ts
0 → 100644
浏览文件 @
e9058f15
import
'
@dcloudio/uni-components/style/button.css
'
import
{
Button
}
from
'
@dcloudio/uni-components
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniButton
extends
UniComponent
{
constructor
(
id
:
number
)
{
super
(
id
,
'
uni-button
'
,
Button
)
}
}
packages/uni-app-plus/src/view/framework/dom/
elements/components/UniButtonElem
ent.ts
→
packages/uni-app-plus/src/view/framework/dom/
components/UniCompon
ent.ts
浏览文件 @
e9058f15
import
'
@dcloudio/uni-components/style/button.css
'
import
{
hasOwn
}
from
'
@vue/shared
'
import
{
Button
}
from
'
@dcloudio/uni-components
'
import
{
createApp
,
reactive
,
watch
}
from
'
vue
'
import
{
createWrapper
}
from
'
.
'
import
{
decodeAttr
,
formatLog
,
parseEventName
,
UniNodeJSON
,
}
from
'
@dcloudio/uni-shared
'
import
{
UniNode
}
from
'
../UniNode
'
import
{
Component
,
createApp
,
reactive
}
from
'
vue
'
import
{
decodeAttr
,
parseEventName
,
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniNode
}
from
'
../elements/UniNode
'
import
{
createInvoker
}
from
'
../modules/events
'
import
{
createWrapper
}
from
'
.
'
const
UniButton
=
createWrapper
(
Button
)
export
class
UniButtonElement
extends
UniNode
{
export
class
UniComponent
extends
UniNode
{
private
$component
:
Component
private
$props
!
:
Record
<
string
,
any
>
constructor
(
id
:
number
)
{
super
(
id
,
'
uni-button
'
)
constructor
(
id
:
number
,
tag
:
string
,
component
:
Component
)
{
super
(
id
,
tag
)
this
.
$component
=
component
}
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
const
container
=
document
.
createElement
(
'
div
'
)
...
...
@@ -28,17 +21,13 @@ export class UniButtonElement extends UniNode {
this
.
setAttr
(
n
,
a
[
n
])
})
}
const
vm
=
createApp
(
UniButton
,
{
attrs
:
this
.
$props
}).
mount
(
container
)
const
vm
=
createApp
(
createWrapper
(
this
.
$component
,
this
.
$props
)).
mount
(
container
)
this
.
$
=
container
.
firstElementChild
!
if
(
hasOwn
(
nodeJson
,
'
t
'
))
{
this
.
$
.
textContent
=
nodeJson
.
t
||
''
}
watch
(
this
.
$props
,
()
=>
{
if
(
__DEV__
)
{
console
.
log
(
formatLog
(
this
.
tag
,
'
props
'
,
'
forceUpdate
'
))
}
vm
.
$forceUpdate
()
})
}
setAttr
(
name
:
string
,
value
:
unknown
)
{
const
decoded
=
decodeAttr
(
name
)
...
...
packages/uni-app-plus/src/view/framework/dom/
elements/
components/index.ts
→
packages/uni-app-plus/src/view/framework/dom/components/index.ts
浏览文件 @
e9058f15
import
{
defineComponent
,
h
,
reactive
}
from
'
vue
'
import
{
UniComment
}
from
'
../UniComment
'
import
{
UniText
}
from
'
../UniText
'
import
{
UniViewElement
}
from
'
../UniViewElement
'
import
{
UniButton
Element
}
from
'
./UniButtonElement
'
import
{
defineComponent
,
h
}
from
'
vue
'
import
{
UniComment
}
from
'
../
elements/
UniComment
'
import
{
UniText
}
from
'
../
elements/
UniText
'
import
{
UniViewElement
}
from
'
../
elements/
UniViewElement
'
import
{
UniButton
}
from
'
./UniButton
'
export
interface
UniCustomElement
extends
Element
{
__id
:
number
...
...
@@ -18,23 +18,18 @@ const BuiltInComponents = [
UniComment
,
,
,
UniButton
Element
,
UniButton
,
]
export
type
WrapperComponent
=
ReturnType
<
typeof
createWrapper
>
export
function
createBuiltInComponent
(
type
:
number
,
id
:
number
)
{
return
new
BuiltInComponents
[
type
]
!
(
id
)
}
export
function
createWrapper
(
component
:
ReturnType
<
typeof
defineComponent
>
)
{
return
defineComponent
({
props
:
[
'
attrs
'
],
data
()
{
return
{
props
:
this
.
attrs
,
}
},
render
()
{
return
h
(
component
,
this
.
props
)
},
})
export
function
createWrapper
(
component
:
ReturnType
<
typeof
defineComponent
>
,
props
:
Record
<
string
,
any
>
)
{
return
()
=>
h
(
component
,
props
)
}
packages/uni-app-plus/src/view/framework/dom/elements/UniElement.ts
浏览文件 @
e9058f15
...
...
@@ -2,10 +2,10 @@ import { hasOwn } from '@vue/shared'
import
{
decodeAttr
,
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
UniNode
}
from
'
./UniNode
'
import
{
patchClass
}
from
'
./modules/class
'
import
{
patchStyle
}
from
'
./modules/style
'
import
{
patchEvent
}
from
'
./modules/events
'
import
{
UniCustomElement
}
from
'
./components
'
import
{
patchClass
}
from
'
.
.
/modules/class
'
import
{
patchStyle
}
from
'
.
.
/modules/style
'
import
{
patchEvent
}
from
'
.
.
/modules/events
'
import
{
UniCustomElement
}
from
'
.
.
/components
'
export
class
UniElement
extends
UniNode
{
$
:
UniCustomElement
...
...
packages/uni-app-plus/src/view/framework/dom/elements/UniNode.ts
浏览文件 @
e9058f15
import
{
hasOwn
}
from
'
@vue/shared
'
import
{
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
$
}
from
'
.
'
import
{
$
}
from
'
.
./page
'
export
class
UniNode
{
id
:
number
...
...
packages/uni-app-plus/src/view/framework/dom/elements/index.ts
已删除
100644 → 0
浏览文件 @
f17e1c0f
import
{
isString
}
from
'
@vue/shared
'
import
{
createBuiltInComponent
}
from
'
./components
'
import
{
UniElement
}
from
'
./UniElement
'
import
{
UniText
}
from
'
./UniText
'
const
elements
=
new
Map
<
number
,
UniElement
|
UniText
>
()
export
function
$
(
id
:
number
)
{
return
elements
.
get
(
id
)
as
UniElement
}
export
function
createElement
(
id
:
number
,
tag
:
string
|
number
)
{
let
element
:
UniElement
|
UniText
if
(
isString
(
tag
))
{
element
=
new
UniElement
(
id
,
document
.
createElement
(
tag
))
}
else
{
element
=
createBuiltInComponent
(
tag
,
id
)
}
elements
.
set
(
id
,
element
)
return
element
}
packages/uni-app-plus/src/view/framework/dom/index.ts
浏览文件 @
e9058f15
...
...
@@ -9,8 +9,7 @@ import {
ACTION_TYPE_SET_TEXT
,
PageAction
,
}
from
'
../../../PageAction
'
import
{
$
,
createElement
}
from
'
./elements
'
import
{
onPageCreate
,
onPageCreated
}
from
'
./page
'
import
{
$
,
createElement
,
onPageCreate
,
onPageCreated
}
from
'
./page
'
export
function
onVdSync
(
actions
:
PageAction
[])
{
actions
.
forEach
((
action
)
=>
{
...
...
packages/uni-app-plus/src/view/framework/dom/
elements/
modules/class.ts
→
packages/uni-app-plus/src/view/framework/dom/modules/class.ts
浏览文件 @
e9058f15
文件已移动
packages/uni-app-plus/src/view/framework/dom/
elements/
modules/events.ts
→
packages/uni-app-plus/src/view/framework/dom/modules/events.ts
浏览文件 @
e9058f15
...
...
@@ -7,8 +7,8 @@ import {
EventModifierFlags
,
normalizeEventType
,
}
from
'
@dcloudio/uni-shared
'
import
{
VD_SYNC
}
from
'
../../../../
../
constants
'
import
{
ACTION_TYPE_EVENT
}
from
'
../../../../
../
PageAction
'
import
{
VD_SYNC
}
from
'
../../../../constants
'
import
{
ACTION_TYPE_EVENT
}
from
'
../../../../PageAction
'
import
{
UniCustomElement
}
from
'
../components
'
export
function
patchEvent
(
el
:
UniCustomElement
,
name
:
string
,
flag
:
number
)
{
...
...
packages/uni-app-plus/src/view/framework/dom/
elements/
modules/style.ts
→
packages/uni-app-plus/src/view/framework/dom/modules/style.ts
浏览文件 @
e9058f15
文件已移动
packages/uni-app-plus/src/view/framework/dom/page.ts
浏览文件 @
e9058f15
import
{
isString
}
from
'
@vue/shared
'
import
{
createScrollListener
,
CreateScrollListenerOptions
,
...
...
@@ -6,7 +7,28 @@ import {
}
from
'
@dcloudio/uni-core
'
import
{
formatLog
}
from
'
@dcloudio/uni-shared
'
import
{
PageCreateData
}
from
'
../../../PageAction
'
import
{
createElement
}
from
'
./elements
'
import
{
createBuiltInComponent
}
from
'
./components
'
import
{
UniElement
}
from
'
./elements/UniElement
'
import
{
UniNode
}
from
'
./elements/UniNode
'
const
elements
=
new
Map
<
number
,
UniNode
>
()
export
function
$
(
id
:
number
)
{
return
elements
.
get
(
id
)
as
UniElement
}
export
function
createElement
(
id
:
number
,
tag
:
string
|
number
)
{
let
element
:
UniNode
if
(
isString
(
tag
))
{
element
=
new
UniElement
(
id
,
document
.
createElement
(
tag
))
}
else
{
element
=
createBuiltInComponent
(
tag
,
id
)
}
elements
.
set
(
id
,
element
)
return
element
}
export
function
onPageCreated
()
{}
...
...
packages/vite-plugin-uni/package.json
浏览文件 @
e9058f15
...
...
@@ -41,7 +41,7 @@
"@types/sass"
:
"^1.16.0"
},
"uni-app"
:
{
"compilerVersion"
:
"3.1.2
1
"
"compilerVersion"
:
"3.1.2
2
"
},
"gitHead"
:
"56deaeb47d42e924d10282d7af418ccee6b139bf"
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录