Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yangkaifeng
uni-app
提交
f6c10c3a
U
uni-app
项目概览
yangkaifeng
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
3
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,发现更多精彩内容 >>
提交
f6c10c3a
编写于
7月 12, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(app): uni-app-plus
上级
7ab93165
变更
22
展开全部
隐藏空白更改
内联
并排
Showing
22 changed file
with
1309 addition
and
1134 deletion
+1309
-1134
packages/uni-app-plus/dist/style.css
packages/uni-app-plus/dist/style.css
+5
-5
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+10
-11
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+1030
-951
packages/uni-app-plus/src/view/components/cover-view/index.tsx
...ges/uni-app-plus/src/view/components/cover-view/index.tsx
+4
-4
packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts
...pp-plus/src/view/framework/dom/components/UniComponent.ts
+1
-3
packages/uni-app-plus/src/view/framework/dom/components/UniText.ts
...uni-app-plus/src/view/framework/dom/components/UniText.ts
+0
-10
packages/uni-app-plus/src/view/framework/dom/components/index.ts
...s/uni-app-plus/src/view/framework/dom/components/index.ts
+2
-2
packages/uni-app-plus/src/view/framework/dom/elements/UniElement.ts
...ni-app-plus/src/view/framework/dom/elements/UniElement.ts
+37
-6
packages/uni-app-plus/src/view/framework/dom/elements/UniHoverElement.ts
...p-plus/src/view/framework/dom/elements/UniHoverElement.ts
+44
-44
packages/uni-app-plus/src/view/framework/dom/elements/UniNode.ts
...s/uni-app-plus/src/view/framework/dom/elements/UniNode.ts
+4
-0
packages/uni-app-plus/src/view/framework/dom/elements/UniTextElement.ts
...pp-plus/src/view/framework/dom/elements/UniTextElement.ts
+40
-0
packages/uni-app-plus/src/view/framework/dom/index.ts
packages/uni-app-plus/src/view/framework/dom/index.ts
+2
-0
packages/uni-app-plus/src/view/framework/dom/scheduler.ts
packages/uni-app-plus/src/view/framework/dom/scheduler.ts
+16
-0
packages/uni-app-plus/src/view/framework/index.ts
packages/uni-app-plus/src/view/framework/index.ts
+0
-7
packages/uni-app-plus/src/view/index.ts
packages/uni-app-plus/src/view/index.ts
+5
-2
packages/uni-app-plus/vite.config.ts
packages/uni-app-plus/vite.config.ts
+1
-0
packages/uni-components/src/components/text/index.tsx
packages/uni-components/src/components/text/index.tsx
+9
-42
packages/uni-components/src/helpers/text.ts
packages/uni-components/src/helpers/text.ts
+40
-0
packages/uni-components/src/index.ts
packages/uni-components/src/index.ts
+2
-0
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+19
-14
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+19
-14
yarn.lock
yarn.lock
+19
-19
未找到文件。
packages/uni-app-plus/dist/style.css
浏览文件 @
f6c10c3a
...
...
@@ -109,6 +109,11 @@ uni-button[loading]:before {
[
nvue
]
uni-swiper-item
{
position
:
absolute
;
}
uni-text
[
selectable
]
{
cursor
:
auto
;
-webkit-user-select
:
text
;
user-select
:
text
;
}
uni-view
{
display
:
block
;
}
...
...
@@ -1693,11 +1698,6 @@ uni-switch .uni-checkbox-input svg {
.uni-checkbox-input.uni-checkbox-input-disabled
:before
{
color
:
#adadad
;
}
uni-text
[
selectable
]
{
cursor
:
auto
;
-webkit-user-select
:
text
;
user-select
:
text
;
}
uni-textarea
{
width
:
300px
;
height
:
150px
;
...
...
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
f6c10c3a
...
...
@@ -4590,7 +4590,7 @@ var serviceContext = (function (vue) {
}
});
}
send
(
args
)
{
send
(
args
,
callopt
=
true
)
{
if
(
this
.
readyState
!==
this
.
OPEN
)
{
callOptions
(
args
,
'
sendSocketMessage:fail WebSocket is not connected
'
);
}
...
...
@@ -4604,23 +4604,23 @@ var serviceContext = (function (vue) {
}
:
args
.
data
,
});
callOptions
(
args
,
'
sendSocketMessage:ok
'
);
call
opt
&&
call
Options
(
args
,
'
sendSocketMessage:ok
'
);
}
catch
(
error
)
{
callOptions
(
args
,
`sendSocketMessage:fail
${
error
}
`
);
call
opt
&&
call
Options
(
args
,
`sendSocketMessage:fail
${
error
}
`
);
}
}
close
(
args
)
{
close
(
args
,
callopt
=
true
)
{
this
.
readyState
=
this
.
CLOSING
;
try
{
this
.
_socket
.
close
(
extend
({
id
:
this
.
id
,
args
,
}));
callOptions
(
args
,
'
closeSocket:ok
'
);
call
opt
&&
call
Options
(
args
,
'
closeSocket:ok
'
);
}
catch
(
error
)
{
callOptions
(
args
,
`closeSocket:fail
${
error
}
`
);
call
opt
&&
call
Options
(
args
,
`closeSocket:fail
${
error
}
`
);
}
}
onOpen
(
callback
)
{
...
...
@@ -4660,21 +4660,20 @@ var serviceContext = (function (vue) {
const
sendSocketMessage
=
defineAsyncApi
(
API_SEND_SOCKET_MESSAGE
,
(
args
,
{
resolve
,
reject
})
=>
{
const
socketTask
=
socketTasks
[
0
];
if
(
!
socketTask
||
socketTask
.
readyState
!==
socketTask
.
OPEN
)
{
reject
(
'
sendSocketMessage:fail
WebSocket is not connected
'
);
reject
(
'
WebSocket is not connected
'
);
return
;
}
socketTask
.
send
({
data
:
args
.
data
});
socketTask
.
send
({
data
:
args
.
data
}
,
false
);
resolve
();
},
SendSocketMessageProtocol
);
const
closeSocket
=
defineAsyncApi
(
API_CLOSE_SOCKET
,
(
args
,
{
resolve
,
reject
})
=>
{
const
socketTask
=
socketTasks
[
0
];
if
(
!
socketTask
)
{
reject
(
'
closeSocket:fail
WebSocket is not connected
'
);
reject
(
'
WebSocket is not connected
'
);
return
;
}
socketTask
.
readyState
=
socketTask
.
CLOSING
;
const
{
code
,
reason
}
=
args
;
socketTask
.
close
({
code
,
reason
});
socketTask
.
close
(
args
,
false
);
resolve
();
},
CloseSocketProtocol
);
function
on
(
event
)
{
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
f6c10c3a
此差异已折叠。
点击以展开。
packages/uni-app-plus/src/view/components/cover-view/index.tsx
浏览文件 @
f6c10c3a
...
...
@@ -4,7 +4,7 @@ import {
useCustomEvent
,
EmitEvent
,
flatVNode
,
Text
,
//
Text,
}
from
'
@dcloudio/uni-components
'
import
{
useCover
}
from
'
../../../helpers/useCover
'
...
...
@@ -22,9 +22,9 @@ export default /*#__PURE__*/ defineBuiltInComponent({
const
defaultSlots
=
slots
.
default
?
flatVNode
(
slots
.
default
())
:
[]
let
text
=
''
defaultSlots
.
forEach
((
node
)
=>
{
if
(
!
node
.
type
===
Text
)
{
text
+=
node
.
children
||
''
}
//
if (!node.type === Text) {
text
+=
node
.
children
||
''
//
}
})
content
.
text
=
text
return
(
...
...
packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts
浏览文件 @
f6c10c3a
...
...
@@ -21,9 +21,7 @@ export class UniComponent extends UniNode {
this
.
setAttr
(
n
,
a
[
n
])
})
}
const
vm
=
createApp
(
createWrapper
(
this
.
$component
,
this
.
$props
)).
mount
(
container
)
createApp
(
createWrapper
(
this
.
$component
,
this
.
$props
)).
mount
(
container
)
this
.
$
=
container
.
firstElementChild
!
if
(
hasOwn
(
nodeJson
,
'
t
'
))
{
this
.
$
.
textContent
=
nodeJson
.
t
||
''
...
...
packages/uni-app-plus/src/view/framework/dom/components/UniText.ts
已删除
100644 → 0
浏览文件 @
7ab93165
import
'
@dcloudio/uni-components/style/text.css
'
import
{
Text
}
from
'
@dcloudio/uni-components
'
import
{
UniComponent
}
from
'
./UniComponent
'
export
class
UniText
extends
UniComponent
{
constructor
(
id
:
number
)
{
super
(
id
,
'
uni-text
'
,
Text
)
}
}
packages/uni-app-plus/src/view/framework/dom/components/index.ts
浏览文件 @
f6c10c3a
import
{
defineComponent
,
h
}
from
'
vue
'
import
{
UniComment
}
from
'
../elements/UniComment
'
import
{
UniTextElement
}
from
'
../elements/UniTextElement
'
import
{
UniTextNode
}
from
'
../elements/UniTextNode
'
import
{
UniViewElement
}
from
'
../elements/UniViewElement
'
import
{
UniAd
}
from
'
./UniAd
'
...
...
@@ -38,7 +39,6 @@ import { UniSlider } from './UniSlider'
import
{
UniSwiper
}
from
'
./UniSwiper
'
import
{
UniSwiperItem
}
from
'
./UniSwiperItem
'
import
{
UniSwitch
}
from
'
./UniSwitch
'
import
{
UniText
}
from
'
./UniText
'
import
{
UniTextarea
}
from
'
./UniTextarea
'
import
{
UniVideo
}
from
'
./UniVideo
'
import
{
UniWebView
}
from
'
./UniWebView
'
...
...
@@ -52,7 +52,7 @@ const BuiltInComponents = [
,
UniViewElement
,
UniImage
,
UniText
,
UniText
Element
,
UniTextNode
,
UniComment
,
UniNavigator
,
...
...
packages/uni-app-plus/src/view/framework/dom/elements/UniElement.ts
浏览文件 @
f6c10c3a
import
{
hasOwn
}
from
'
@vue/shared
'
import
{
decodeAttr
,
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
import
{
reactive
,
watch
}
from
'
vue
'
import
{
UniNode
}
from
'
./UniNode
'
import
{
patchClass
}
from
'
../modules/class
'
import
{
patchStyle
}
from
'
../modules/style
'
import
{
patchEvent
}
from
'
../modules/events
'
import
{
UniCustomElement
}
from
'
../components
'
import
{
queuePostActionJob
}
from
'
../scheduler
'
export
class
UniElement
extends
UniNode
{
export
class
UniElement
<
T
extends
object
>
extends
UniNode
{
$
:
UniCustomElement
constructor
(
id
:
number
,
element
:
Element
)
{
$props
:
T
=
reactive
({}
as
any
)
$propNames
:
string
[]
protected
_update
?:
Function
constructor
(
id
:
number
,
element
:
Element
,
propNames
:
string
[]
=
[])
{
super
(
id
,
element
.
tagName
)
this
.
$
=
element
as
UniCustomElement
this
.
$
.
__id
=
id
this
.
$
.
__listeners
=
Object
.
create
(
null
)
this
.
$propNames
=
propNames
this
.
_update
=
this
.
update
.
bind
(
this
)
}
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
super
.
init
(
nodeJson
)
if
(
hasOwn
(
nodeJson
,
'
a
'
))
{
this
.
setAttrs
(
nodeJson
.
a
!
)
}
super
.
init
(
nodeJson
)
watch
(
this
.
$props
,
()
=>
{
queuePostActionJob
(
this
.
_update
!
)
},
{
flush
:
'
sync
'
}
)
this
.
update
()
}
setAttrs
(
attrs
:
Record
<
string
,
any
>
)
{
Object
.
keys
(
attrs
).
forEach
((
name
)
=>
{
...
...
@@ -34,7 +50,7 @@ export class UniElement extends UniNode {
}
else
if
(
name
.
indexOf
(
'
.e
'
)
===
0
)
{
patchEvent
(
this
.
$
,
name
,
value
as
number
)
}
else
{
this
.
$
.
setAttribute
(
decodeAttr
(
name
),
value
as
string
)
this
.
setAttribute
(
decodeAttr
(
name
),
value
as
string
)
}
}
removeAttr
(
name
:
string
)
{
...
...
@@ -45,7 +61,22 @@ export class UniElement extends UniNode {
}
else
if
(
name
.
indexOf
(
'
.e
'
)
===
0
)
{
patchEvent
(
this
.
$
,
name
,
-
1
)
}
else
{
this
.
$
.
removeAttribute
(
decodeAttr
(
name
))
this
.
removeAttribute
(
decodeAttr
(
name
))
}
}
setAttribute
(
name
:
string
,
value
:
unknown
)
{
if
(
this
.
$propNames
.
indexOf
(
name
)
!==
-
1
)
{
;(
this
.
$props
as
any
)[
name
]
=
value
}
else
{
this
.
$
.
setAttribute
(
name
,
value
as
string
)
}
}
removeAttribute
(
name
:
string
)
{
if
(
this
.
$propNames
.
indexOf
(
name
)
!==
-
1
)
{
delete
(
this
.
$props
as
any
)[
name
]
}
else
{
this
.
$
.
removeAttribute
(
name
)
}
}
update
()
{}
}
packages/uni-app-plus/src/view/framework/dom/elements/UniHoverElement.ts
浏览文件 @
f6c10c3a
import
{
camelize
}
from
'
@vue/shared
'
import
{
decodeAttr
,
formatLog
}
from
'
@dcloudio/uni-shared
'
import
{
formatLog
}
from
'
@dcloudio/uni-shared
'
import
{
UniElement
}
from
'
./UniElement
'
function
isHoverAttr
(
name
:
string
)
{
return
name
.
indexOf
(
'
.h
'
)
===
0
interface
HoverProps
{
'
hover-class
'
:
string
|
'
none
'
'
hover-stop-propagation
'
:
boolean
'
hover-start-time
'
:
number
'
hover-stay-time
'
:
number
}
export
class
UniHoverElement
extends
UniElement
{
const
PROP_NAMES_HOVER
=
[
'
hover-class
'
,
'
hover-stop-propagation
'
,
'
hover-start-time
'
,
'
hover-stay-time
'
,
]
export
class
UniHoverElement
extends
UniElement
<
HoverProps
>
{
private
_hover
?:
Hover
setAttr
(
name
:
string
,
value
:
unknown
)
{
if
(
!
isHoverAttr
(
name
))
{
return
super
.
setAttr
(
name
,
value
)
}
name
=
camelize
(
decodeAttr
(
name
))
if
(
!
this
.
_hover
)
{
this
.
_hover
=
new
Hover
(
this
.
$
)
}
const
{
_hover
}
=
this
;(
_hover
as
any
)[
name
]
=
value
if
(
name
!==
'
hoverClass
'
)
{
return
}
if
(
_hover
.
hoverClass
&&
_hover
.
hoverClass
!==
'
none
'
)
{
_hover
.
addEvent
()
}
else
{
_hover
.
removeEvent
()
}
constructor
(
id
:
number
,
element
:
Element
,
propNames
:
string
[]
=
[])
{
super
(
id
,
element
,
[...
PROP_NAMES_HOVER
,
...
propNames
])
}
removeAttr
(
name
:
string
)
{
if
(
!
isHoverAttr
(
name
))
{
return
super
.
removeAttr
(
name
)
update
()
{
const
hoverClass
=
this
.
$props
[
'
hover-class
'
]
if
(
hoverClass
&&
hoverClass
!==
'
none
'
)
{
if
(
!
this
.
_hover
)
{
this
.
_hover
=
new
Hover
(
this
.
$
,
this
.
$props
)
}
this
.
_hover
.
addEvent
()
}
else
{
if
(
this
.
_hover
)
{
this
.
_hover
.
removeEvent
()
}
}
}
}
...
...
@@ -38,10 +36,7 @@ export class UniHoverElement extends UniElement {
class
Hover
{
private
$
:
Element
hoverClass
:
string
=
'
none
'
hoverStopPropagation
:
boolean
=
false
hoverStartTime
:
number
=
50
hoverStayTime
:
number
=
400
private
props
:
HoverProps
private
_listening
:
boolean
=
false
...
...
@@ -53,9 +48,11 @@ class Hover {
private
__hoverTouchStart
!
:
(
evt
:
Event
)
=>
void
private
__hoverTouchEnd
!
:
(
evt
?:
Event
)
=>
void
private
__hoverTouchCancel
!
:
(
evt
?:
Event
)
=>
void
constructor
(
$
:
Element
)
{
constructor
(
$
:
Element
,
props
:
HoverProps
)
{
this
.
$
=
$
this
.
props
=
props
this
.
__hoverTouchStart
=
this
.
_hoverTouchStart
.
bind
(
this
)
this
.
__hoverTouchEnd
=
this
.
_hoverTouchEnd
.
bind
(
this
)
this
.
__hoverTouchCancel
=
this
.
_hoverTouchCancel
.
bind
(
this
)
...
...
@@ -67,10 +64,11 @@ class Hover {
set
hovering
(
hovering
:
boolean
)
{
this
.
_hovering
=
hovering
const
hoverClass
=
this
.
props
[
'
hover-class
'
]
if
(
hovering
)
{
this
.
$
.
classList
.
add
(
this
.
hoverClass
)
this
.
$
.
classList
.
add
(
hoverClass
)
}
else
{
this
.
$
.
classList
.
remove
(
this
.
hoverClass
)
this
.
$
.
classList
.
remove
(
hoverClass
)
}
}
...
...
@@ -80,7 +78,12 @@ class Hover {
}
if
(
__DEV__
)
{
console
.
log
(
formatLog
(
this
.
$
.
tagName
,
'
Hover
'
,
'
addEventListener
'
,
this
.
hoverClass
)
formatLog
(
this
.
$
.
tagName
,
'
Hover
'
,
'
addEventListener
'
,
this
.
props
[
'
hover-class
'
]
)
)
}
this
.
_listening
=
true
...
...
@@ -104,17 +107,14 @@ class Hover {
if
((
evt
as
any
).
_hoverPropagationStopped
)
{
return
}
if
(
!
this
.
hoverClass
||
this
.
hoverClass
===
'
none
'
||
(
this
.
$
as
any
).
disabled
)
{
const
hoverClass
=
this
.
props
[
'
hover-class
'
]
if
(
!
hoverClass
||
hoverClass
===
'
none
'
||
(
this
.
$
as
any
).
disabled
)
{
return
}
if
((
evt
as
TouchEvent
).
touches
.
length
>
1
)
{
return
}
if
(
this
.
hoverStopPropagation
)
{
if
(
this
.
props
[
'
hover-stop-propagation
'
]
)
{
;(
evt
as
any
).
_hoverPropagationStopped
=
true
}
this
.
_hoverTouch
=
true
...
...
@@ -124,7 +124,7 @@ class Hover {
// 防止在hoverStartTime时间内触发了 touchend 或 touchcancel
this
.
_hoverReset
()
}
},
this
.
hoverStartTime
)
},
this
.
props
[
'
hover-start-time
'
]
)
}
_hoverTouchEnd
()
{
this
.
_hoverTouch
=
false
...
...
@@ -137,7 +137,7 @@ class Hover {
clearTimeout
(
this
.
_hoverStayTimer
)
this
.
_hoverStayTimer
=
setTimeout
(()
=>
{
this
.
hovering
=
false
},
this
.
hoverStayTime
)
},
this
.
props
[
'
hover-stay-time
'
]
)
})
}
_hoverTouchCancel
()
{
...
...
packages/uni-app-plus/src/view/framework/dom/elements/UniNode.ts
浏览文件 @
f6c10c3a
...
...
@@ -7,6 +7,8 @@ export class UniNode {
id
:
number
tag
:
string
$
!
:
Element
|
Text
|
Comment
isMounted
:
boolean
=
false
isUnmounted
:
boolean
=
false
constructor
(
id
:
number
,
tag
:
string
)
{
this
.
id
=
id
this
.
tag
=
tag
...
...
@@ -32,9 +34,11 @@ export class UniNode {
}
else
{
parentNode
.
insertBefore
(
node
,
$
(
refNodeId
).
$
)
}
this
.
isMounted
=
true
}
remove
()
{
const
{
$
}
=
this
$
.
parentNode
!
.
removeChild
(
$
)
this
.
isUnmounted
=
false
}
}
packages/uni-app-plus/src/view/framework/dom/elements/UniTextElement.ts
0 → 100644
浏览文件 @
f6c10c3a
import
'
@dcloudio/uni-components/style/text.css
'
import
{
DecodeOptions
,
parseText
}
from
'
@dcloudio/uni-components
'
import
{
UniElement
}
from
'
./UniElement
'
import
{
formatLog
,
UniNodeJSON
}
from
'
@dcloudio/uni-shared
'
interface
TextProps
{
space
:
DecodeOptions
[
'
space
'
]
decode
:
boolean
}
const
PROP_NAMES_HOVER
=
[
'
space
'
,
'
decode
'
]
export
class
UniTextElement
extends
UniElement
<
TextProps
>
{
private
_text
:
string
=
''
constructor
(
id
:
number
)
{
super
(
id
,
document
.
createElement
(
'
uni-text
'
),
PROP_NAMES_HOVER
)
}
init
(
nodeJson
:
Partial
<
UniNodeJSON
>
)
{
this
.
_text
=
nodeJson
.
t
||
''
super
.
init
(
nodeJson
)
}
setText
(
text
:
string
)
{
this
.
_text
=
text
}
update
()
{
if
(
__DEV__
)
{
console
.
log
(
formatLog
(
'
Text
'
,
'
update
'
))
}
const
{
$props
:
{
space
,
decode
},
}
=
this
this
.
$
.
innerHTML
=
parseText
(
this
.
_text
,
{
space
,
decode
,
}).
join
(
'
<br>
'
)
}
}
packages/uni-app-plus/src/view/framework/dom/index.ts
浏览文件 @
f6c10c3a
...
...
@@ -10,6 +10,7 @@ import {
PageAction
,
}
from
'
../../../PageAction
'
import
{
$
,
createElement
,
onPageCreate
,
onPageCreated
}
from
'
./page
'
import
{
flushPostActionJobs
}
from
'
./scheduler
'
export
function
onVdSync
(
actions
:
PageAction
[])
{
actions
.
forEach
((
action
)
=>
{
...
...
@@ -32,4 +33,5 @@ export function onVdSync(actions: PageAction[]) {
return
$
(
action
[
1
]).
setText
(
action
[
2
])
}
})
flushPostActionJobs
()
}
packages/uni-app-plus/src/view/framework/dom/scheduler.ts
0 → 100644
浏览文件 @
f6c10c3a
import
{
formatLog
}
from
'
@dcloudio/uni-shared
'
const
postActionJobs
=
new
Set
<
Function
>
()
export
function
queuePostActionJob
(
job
:
Function
)
{
postActionJobs
.
add
(
job
)
}
export
function
flushPostActionJobs
()
{
if
(
__DEV__
)
{
console
.
log
(
formatLog
(
`flushPostActionJobs`
,
postActionJobs
.
size
))
}
try
{
postActionJobs
.
forEach
((
fn
)
=>
fn
())
}
finally
{
postActionJobs
.
clear
()
}
}
packages/uni-app-plus/src/view/framework/index.ts
已删除
100644 → 0
浏览文件 @
7ab93165
import
{
initSubscribeHandlers
}
from
'
./subscriber
'
import
{
preventDoubleTap
}
from
'
./gesture
'
export
function
initView
()
{
initSubscribeHandlers
()
preventDoubleTap
()
}
packages/uni-app-plus/src/view/index.ts
浏览文件 @
f6c10c3a
import
'
../../style/framework/base.css
'
import
'
@dcloudio/uni-h5/style/framework/nvue.css
'
import
{
initView
}
from
'
@dcloudio/uni-core
'
import
{
ON_WEBVIEW_READY
}
from
'
../constants
'
import
{
UniViewJSBridge
}
from
'
./bridge
'
import
{
initView
}
from
'
./framework
'
import
*
as
uni
from
'
./api
'
import
{
preventDoubleTap
}
from
'
./framework/gesture
'
import
{
initSubscribeHandlers
}
from
'
./framework/subscriber
'
;(
window
as
any
).
uni
=
uni
;(
window
as
any
).
UniViewJSBridge
=
UniViewJSBridge
;(
window
as
any
).
rpx2px
=
uni
.
upx2px
function
onWebviewReady
()
{
initView
()
initSubscribeHandlers
()
preventDoubleTap
()
UniViewJSBridge
.
publishHandler
(
ON_WEBVIEW_READY
)
}
if
(
typeof
plus
!==
'
undefined
'
)
{
...
...
packages/uni-app-plus/vite.config.ts
浏览文件 @
f6c10c3a
...
...
@@ -22,6 +22,7 @@ const rollupPlugins = [
defineSyncApi
:
`/*#__PURE__*/ defineSyncApi`
,
defineAsyncApi
:
`/*#__PURE__*/ defineAsyncApi`
,
__IMPORT_META_ENV_BASE_URL__
:
'
import.meta.env.BASE_URL
'
,
//直接使用import.meta.env.BASE_URL会被vite替换成'/'
__UNI_FEATURE_LONGPRESS__
:
JSON
.
stringify
(
true
),
},
preventAssignment
:
true
,
}),
...
...
packages/uni-components/src/components/text/index.tsx
浏览文件 @
f6c10c3a
import
{
VNode
,
Component
,
createTextVNode
,
createVNode
}
from
'
vue
'
import
{
defineBuiltInComponent
}
from
'
../../helpers/component
'
const
SPACE_UNICODE
=
{
ensp
:
'
\
u2002
'
,
emsp
:
'
\
u2003
'
,
nbsp
:
'
\
u00a0
'
,
}
interface
DecodeOptions
{
space
:
keyof
typeof
SPACE_UNICODE
decode
:
boolean
}
function
normalizeText
(
text
:
string
,
{
space
,
decode
}:
DecodeOptions
)
{
if
(
space
&&
SPACE_UNICODE
[
space
])
{
text
=
text
.
replace
(
/ /g
,
SPACE_UNICODE
[
space
])
}
if
(
!
decode
)
{
return
text
}
return
text
.
replace
(
/ /g
,
SPACE_UNICODE
.
nbsp
)
.
replace
(
/ /g
,
SPACE_UNICODE
.
ensp
)
.
replace
(
/ /g
,
SPACE_UNICODE
.
emsp
)
.
replace
(
/</g
,
'
<
'
)
.
replace
(
/>/g
,
'
>
'
)
.
replace
(
/&/g
,
'
&
'
)
.
replace
(
/"/g
,
'
"
'
)
.
replace
(
/'/g
,
"
'
"
)
}
import
{
DecodeOptions
,
parseText
}
from
'
../../helpers/text
'
export
default
/*#__PURE__*/
defineBuiltInComponent
({
name
:
'
Text
'
,
...
...
@@ -51,22 +24,16 @@ export default /*#__PURE__*/ defineBuiltInComponent({
if
(
slots
.
default
)
{
slots
.
default
().
forEach
((
vnode
)
=>
{
if
(
vnode
.
shapeFlag
&
8
/* TEXT_CHILDREN */
)
{
const
lines
=
(
vnode
.
children
as
string
)
.
replace
(
/
\\
n/g
,
'
\n
'
)
.
split
(
'
\n
'
)
const
lines
=
parseText
(
vnode
.
children
as
string
,
{
space
:
props
.
space
as
DecodeOptions
[
'
space
'
],
decode
:
props
.
decode
as
boolean
,
})
const
len
=
lines
.
length
-
1
lines
.
forEach
((
text
,
index
)
=>
{
if
(
index
===
0
&&
!
text
)
{
//临时方案解决(<text>\n横向布局</text>) Hydration node mismatch
lines
.
forEach
((
line
,
index
)
=>
{
if
(
index
===
0
&&
!
line
)
{
//
临时方案解决(<text>\n横向布局</text>) Hydration node mismatch
}
else
{
children
.
push
(
createTextVNode
(
normalizeText
(
text
,
{
space
:
props
.
space
as
DecodeOptions
[
'
space
'
],
decode
:
props
.
decode
as
boolean
,
})
)
)
children
.
push
(
createTextVNode
(
line
))
}
if
(
index
!==
len
)
{
children
.
push
(
createVNode
(
'
br
'
))
...
...
packages/uni-components/src/helpers/text.ts
0 → 100644
浏览文件 @
f6c10c3a
const
SPACE_UNICODE
=
{
ensp
:
'
\
u2002
'
,
emsp
:
'
\
u2003
'
,
nbsp
:
'
\
u00a0
'
,
}
export
interface
DecodeOptions
{
space
?:
keyof
typeof
SPACE_UNICODE
decode
?:
boolean
}
export
function
parseText
(
text
:
string
,
options
:
DecodeOptions
)
{
return
text
.
replace
(
/
\\
n/g
,
'
\n
'
)
.
split
(
'
\n
'
)
.
map
((
text
)
=>
{
return
normalizeText
(
text
,
options
)
})
}
function
normalizeText
(
text
:
string
,
{
space
,
decode
}:
DecodeOptions
)
{
if
(
!
text
)
{
return
text
}
if
(
space
&&
SPACE_UNICODE
[
space
])
{
text
=
text
.
replace
(
/ /g
,
SPACE_UNICODE
[
space
])
}
if
(
!
decode
)
{
return
text
}
return
text
.
replace
(
/ /g
,
SPACE_UNICODE
.
nbsp
)
.
replace
(
/ /g
,
SPACE_UNICODE
.
ensp
)
.
replace
(
/ /g
,
SPACE_UNICODE
.
emsp
)
.
replace
(
/</g
,
'
<
'
)
.
replace
(
/>/g
,
'
>
'
)
.
replace
(
/&/g
,
'
&
'
)
.
replace
(
/"/g
,
'
"
'
)
.
replace
(
/'/g
,
"
'
"
)
}
packages/uni-components/src/index.ts
浏览文件 @
f6c10c3a
...
...
@@ -12,6 +12,7 @@ export type {
EmitEvent
,
}
from
'
./helpers/useEvent
'
export
*
from
'
./helpers/scroller
'
export
{
parseText
}
from
'
./helpers/text
'
export
{
useUserAction
}
from
'
./helpers/useUserAction
'
export
{
useAttrs
}
from
'
./helpers/useAttrs
'
export
{
useBooleanAttr
}
from
'
./helpers/useBooleanAttr
'
...
...
@@ -23,3 +24,4 @@ export {
export
{
flatVNode
}
from
'
./helpers/flatVNode
'
export
{
uniFormKey
}
from
'
./components/form
'
export
type
{
UniFormCtx
}
from
'
./components/form
'
export
type
{
DecodeOptions
}
from
'
./helpers/text
'
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
f6c10c3a
...
...
@@ -6284,18 +6284,20 @@ function useSwitchInject(props2, switchChecked) {
}
return
uniLabel
;
}
function
_isSlot$3
(
s
)
{
return
typeof
s
===
"
function
"
||
Object
.
prototype
.
toString
.
call
(
s
)
===
"
[object Object]
"
&&
!
vue
.
isVNode
(
s
);
}
const
SPACE_UNICODE
=
{
ensp
:
"
\
u2002
"
,
emsp
:
"
\
u2003
"
,
nbsp
:
"
\
xA0
"
};
function
normalizeText
(
text
,
{
space
,
decode
})
{
function
parseText
(
text
,
options
)
{
return
text
.
replace
(
/
\\
n/g
,
"
\n
"
).
split
(
"
\n
"
).
map
((
text2
)
=>
{
return
normalizeText
(
text2
,
options
);
});
}
function
normalizeText
(
text
,
{
space
,
decode
})
{
if
(
!
text
)
{
return
text
;
}
if
(
space
&&
SPACE_UNICODE
[
space
])
{
text
=
text
.
replace
(
/ /g
,
SPACE_UNICODE
[
space
]);
}
...
...
@@ -6304,6 +6306,9 @@ function normalizeText(text, {
}
return
text
.
replace
(
/ /g
,
SPACE_UNICODE
.
nbsp
).
replace
(
/ /g
,
SPACE_UNICODE
.
ensp
).
replace
(
/ /g
,
SPACE_UNICODE
.
emsp
).
replace
(
/</g
,
"
<
"
).
replace
(
/>/g
,
"
>
"
).
replace
(
/&/g
,
"
&
"
).
replace
(
/"/g
,
'
"
'
).
replace
(
/'/g
,
"
'
"
);
}
function
_isSlot$3
(
s
)
{
return
typeof
s
===
"
function
"
||
Object
.
prototype
.
toString
.
call
(
s
)
===
"
[object Object]
"
&&
!
vue
.
isVNode
(
s
);
}
var
index$d
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Text
"
,
props
:
{
...
...
@@ -6329,16 +6334,16 @@ var index$d = /* @__PURE__ */ defineBuiltInComponent({
if
(
slots
.
default
)
{
slots
.
default
().
forEach
((
vnode
)
=>
{
if
(
vnode
.
shapeFlag
&
8
)
{
const
lines
=
vnode
.
children
.
replace
(
/
\\
n/g
,
"
\n
"
).
split
(
"
\n
"
);
const
lines
=
parseText
(
vnode
.
children
,
{
space
:
props2
.
space
,
decode
:
props2
.
decode
});
const
len
=
lines
.
length
-
1
;
lines
.
forEach
((
text
,
index2
)
=>
{
if
(
index2
===
0
&&
!
text
)
lines
.
forEach
((
line
,
index2
)
=>
{
if
(
index2
===
0
&&
!
line
)
;
else
{
children
.
push
(
vue
.
createTextVNode
(
normalizeText
(
text
,
{
space
:
props2
.
space
,
decode
:
props2
.
decode
})));
children
.
push
(
vue
.
createTextVNode
(
line
));
}
if
(
index2
!==
len
)
{
children
.
push
(
vue
.
createVNode
(
"
br
"
));
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
f6c10c3a
...
...
@@ -12718,18 +12718,20 @@ function useSwitchInject(props2, switchChecked) {
}
return uniLabel;
}
function _isSlot$5(s) {
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
}
const SPACE_UNICODE = {
ensp: "\u2002",
emsp: "\u2003",
nbsp: "\xA0"
};
function normalizeText(text2, {
space,
decode: decode2
}) {
function parseText(text2, options) {
return text2.replace(/\\n/g, "\n").split("\n").map((text22) => {
return normalizeText(text22, options);
});
}
function normalizeText(text2, { space, decode: decode2 }) {
if (!text2) {
return text2;
}
if (space && SPACE_UNICODE[space]) {
text2 = text2.replace(/ /g, SPACE_UNICODE[space]);
}
...
...
@@ -12738,6 +12740,9 @@ function normalizeText(text2, {
}
return text2.replace(/ /g, SPACE_UNICODE.nbsp).replace(/ /g, SPACE_UNICODE.ensp).replace(/ /g, SPACE_UNICODE.emsp).replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'");
}
function _isSlot$5(s) {
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
}
var index$d = /* @__PURE__ */ defineBuiltInComponent({
name: "Text",
props: {
...
...
@@ -12763,16 +12768,16 @@ var index$d = /* @__PURE__ */ defineBuiltInComponent({
if (slots.default) {
slots.default().forEach((vnode) => {
if (vnode.shapeFlag & 8) {
const lines = vnode.children.replace(/\\n/g, "\n").split("\n");
const lines = parseText(vnode.children, {
space: props2.space,
decode: props2.decode
});
const len = lines.length - 1;
lines.forEach((
text2
, index2) => {
if (index2 === 0 && !
text2
)
lines.forEach((
line
, index2) => {
if (index2 === 0 && !
line
)
;
else {
children.push(createTextVNode(normalizeText(text2, {
space: props2.space,
decode: props2.decode
})));
children.push(createTextVNode(line));
}
if (index2 !== len) {
children.push(createVNode("br"));
...
...
yarn.lock
浏览文件 @
f6c10c3a
...
...
@@ -924,8 +924,8 @@
"@dcloudio/types@^2.3.2":
version "2.3.2"
resolved "https://registry.
nlark.com/@dcloudio/types/download/@dcloudio
/types-2.3.2.tgz#8c4c7e22ad650588935d07754c1f1552d86b7a97"
integrity sha
1-jEx+Iq1lBYiTXQd1TB8VUthrepc
=
resolved "https://registry.
yarnpkg.com/@dcloudio/types/-
/types-2.3.2.tgz#8c4c7e22ad650588935d07754c1f1552d86b7a97"
integrity sha
512-ZyAkqPwlPtXtGcf7qYkB/iX4nER/JcNeCXR2VPqXxBmagE8wjRYtkKjso1YUsFyDIoaNBBY1CtzV3iKa6oREeg=
=
"@eslint/eslintrc@^0.4.2":
version "0.4.2"
...
...
@@ -2382,9 +2382,9 @@
integrity sha512-DN/CCT1HQG6HquBNJdLkvV+4v5l/oEuwOHUPLxI+Eub0NED+lk0YUfba04WGH90EINiUrNgClkNnwGmbICeWMQ==
"@types/node@*":
version "16.3.
0
"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.3.
0.tgz#1836664e4fad13b51b07eb6e882a53925e6543c
4"
integrity sha512-
OydMCocGMGqw/1BnWbhtK+AtwyWTOigtrQlRe57OQmTNcI3HKlVI5FGlh+c4mSqInMPLynFrTlYjfajPu9O/eQ
==
version "16.3.
1
"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.3.
1.tgz#24691fa2b0c3ec8c0d34bfcfd495edac5593ebb
4"
integrity sha512-
N87VuQi7HEeRJkhzovao/JviiqKjDKMVKxKMfUvSKw+MbkbW8R0nA3fi/MQhhlxV2fQ+2ReM+/Nt4efdrJx3zA
==
"@types/node@10.17.13":
version "10.17.13"
...
...
@@ -2941,12 +2941,12 @@ at-least-node@^1.0.0:
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
autoprefixer@^10.2.5:
version "10.
2.6
"
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.
2.6.tgz#aadd9ec34e1c98d403e01950038049f0eb252949
"
integrity sha512-
8lChSmdU6dCNMCQopIf4Pe5kipkAGj/fvTMslCsih0uHpOrXOPUEVOmYMMqmw3cekQkSD7EhIeuYl5y0BLdKq
g==
version "10.
3.0
"
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.
3.0.tgz#c60803dce9268f7fe0a5e5c1fe48a74356d7b864
"
integrity sha512-
BzVzdjs47nT3MphTddr8eSsPVEIUCF96X6iC8V5iEB8RtxrU+ybtdhHV5rsqRqOsoyh/acQaYs7YupHPUECgm
g==
dependencies:
browserslist "^4.16.6"
caniuse-lite "^1.0.300012
30
"
caniuse-lite "^1.0.300012
43
"
colorette "^1.2.2"
fraction.js "^4.1.1"
normalize-range "^0.1.2"
...
...
@@ -3327,7 +3327,7 @@ camelcase@^6.0.0, camelcase@^6.2.0:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809"
integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==
caniuse-lite@^1.0.30001219, caniuse-lite@^1.0.300012
30
:
caniuse-lite@^1.0.30001219, caniuse-lite@^1.0.300012
43
:
version "1.0.30001243"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001243.tgz#d9250155c91e872186671c523f3ae50cfc94a3aa"
integrity sha512-vNxw9mkTBtkmLFnJRv/2rhs1yufpDfCkBZexG3Y0xdOH2Z/eE/85E4Dl5j1YUN34nZVsSp6vVRFQRrez9wJMRA==
...
...
@@ -4066,9 +4066,9 @@ ee-first@1.1.1:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
electron-to-chromium@^1.3.723:
version "1.3.77
1
"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.77
1.tgz#c4aa601e6420e11926095f75fe803956a1b4bd81
"
integrity sha512-
zHMomTqkpnAD9W5rhXE1aiU3ogGFrqWzdvM4C6222SREiqsWQb2w0S7P2Ii44qCaGimmAP1z+OydllM438uJy
A==
version "1.3.77
2
"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.77
2.tgz#fd1ed39f9f3149f62f581734e4f026e600369479
"
integrity sha512-
X/6VRCXWALzdX+RjCtBU6cyg8WZgoxm9YA02COmDOiNJEZ59WkQggDbWZ4t/giHi/3GS+cvdrP6gbLISANAGY
A==
elliptic@^6.5.3:
version "6.5.4"
...
...
@@ -8289,9 +8289,9 @@ rollup-pluginutils@^2.3.1, rollup-pluginutils@^2.8.2:
estree-walker "^0.6.1"
rollup@^2.35.1, rollup@^2.38.5:
version "2.53.
0
"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.53.
0.tgz#5b6bc7820a03f361d2ae3dcabdc99d269a754709
"
integrity sha512-
spgrY78Toh+m0+zaOoeaayJKuzFuWy6o1PdFIBMVwRcuxT0xCOX9A5rChyKe+2ruL4lePKWUMImS4mMW1QAkmQ
==
version "2.53.
1
"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.53.
1.tgz#b60439efd1eb41bdb56630509bd99aae78b575d3
"
integrity sha512-
yiTCvcYXZEulNWNlEONOQVlhXA/hgxjelFSjNcrwAAIfYx/xqjSHwqg/cCaWOyFRKr+IQBaXwt723m8tCaIUiw
==
optionalDependencies:
fsevents "~2.3.2"
...
...
@@ -9567,9 +9567,9 @@ write-pkg@^4.0.0:
write-json-file "^3.2.0"
ws@^7.4.5:
version "7.5.
2
"
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.
2.tgz#09cc8fea3bec1bc5ed44ef51b42f945be36900f6
"
integrity sha512-
lkF7AWRicoB9mAgjeKbGqVUekLnSNO4VjKVnuPHpQeOxZOErX6BPXwJk70nFslRCEEA8EVW7ZjKwXaP9N+1sKQ
==
version "7.5.
3
"
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.
3.tgz#160835b63c7d97bfab418fc1b8a9fced2ac01a74
"
integrity sha512-
kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg
==
xml-name-validator@^3.0.0:
version "3.0.0"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录