Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
touchx
uni-app
提交
95c21b23
U
uni-app
项目概览
touchx
/
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,发现更多精彩内容 >>
提交
95c21b23
编写于
3月 25, 2020
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of github.com:dcloudio/uni-app into dev
上级
1833709d
1ee8e20c
变更
12
展开全部
显示空白变更内容
内联
并排
Showing
12 changed file
with
1091 addition
and
295 deletion
+1091
-295
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+61
-94
packages/uni-app-plus/dist/service.runtime.esm.dev.js
packages/uni-app-plus/dist/service.runtime.esm.dev.js
+493
-83
packages/uni-app-plus/dist/service.runtime.esm.prod.js
packages/uni-app-plus/dist/service.runtime.esm.prod.js
+493
-83
packages/uni-app-plus/dist/view.css
packages/uni-app-plus/dist/view.css
+1
-1
packages/uni-app-plus/dist/view.umd.min.js
packages/uni-app-plus/dist/view.umd.min.js
+1
-1
packages/uni-cli-shared/components/navigation-bar.vue
packages/uni-cli-shared/components/navigation-bar.vue
+1
-1
packages/uni-migration/lib/index.js
packages/uni-migration/lib/index.js
+2
-2
src/platforms/app-plus/helpers/util.js
src/platforms/app-plus/helpers/util.js
+15
-0
src/platforms/app-plus/service/framework/plugins/data.js
src/platforms/app-plus/service/framework/plugins/data.js
+7
-10
src/platforms/app-plus/service/framework/plugins/vdom-sync.js
...platforms/app-plus/service/framework/plugins/vdom-sync.js
+4
-8
src/platforms/app-plus/view/framework/plugins/event.js
src/platforms/app-plus/view/framework/plugins/event.js
+6
-5
src/platforms/app-plus/view/framework/plugins/vdom-sync.js
src/platforms/app-plus/view/framework/plugins/vdom-sync.js
+7
-7
未找到文件。
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
95c21b23
...
...
@@ -2319,8 +2319,8 @@ var serviceContext = (function () {
const
callbackId
=
invokeCallbackId
++
;
const
invokeCallbackName
=
'
api.
'
+
apiName
+
'
.
'
+
callbackId
;
const
invokeCallback
=
function
(
res
)
{
callback
(
res
);
const
invokeCallback
=
function
(
res
,
extras
)
{
callback
(
res
,
extras
);
};
invokeCallbacks
[
callbackId
]
=
{
...
...
@@ -2464,15 +2464,15 @@ var serviceContext = (function () {
callbackId
}
}
function
invokeCallbackHandler
(
invokeCallbackId
,
res
)
{
// onNativeEventReceive((event,data)=>{}) 需要两个参数,写死最多两个参数,避免改动太大,影响已有逻辑
function
invokeCallbackHandler
(
invokeCallbackId
,
res
,
extras
)
{
if
(
typeof
invokeCallbackId
===
'
number
'
)
{
const
invokeCallback
=
invokeCallbacks
[
invokeCallbackId
];
if
(
invokeCallback
)
{
if
(
!
invokeCallback
.
keepAlive
)
{
delete
invokeCallbacks
[
invokeCallbackId
];
}
return
invokeCallback
.
callback
(
res
)
return
invokeCallback
.
callback
(
res
,
extras
)
}
}
return
res
...
...
@@ -2970,15 +2970,10 @@ var serviceContext = (function () {
}
function
getScreenInfo
()
{
const
orientation
=
plus
.
navigator
.
getOrientation
();
const
landscape
=
Math
.
abs
(
orientation
)
===
90
;
// 安卓 plus 接口获取的屏幕大小值不为整数
const
width
=
plus
.
screen
.
resolutionWidth
;
const
height
=
plus
.
screen
.
resolutionHeight
;
// 根据方向纠正宽高
const
{
resolutionWidth
,
resolutionHeight
}
=
plus
.
screen
.
getCureentSize
();
return
{
screenWidth
:
Math
[
landscape
?
'
max
'
:
'
min
'
](
width
,
height
),
screenHeight
:
Math
[
landscape
?
'
min
'
:
'
max
'
](
width
,
h
eight
)
screenWidth
:
Math
.
round
(
resolutionWidth
),
screenHeight
:
Math
.
round
(
resolutionH
eight
)
}
}
...
...
@@ -3990,16 +3985,6 @@ var serviceContext = (function () {
return
true
}
function
checkDevices
(
data
)
{
data
.
devices
=
data
.
devices
.
map
(
device
=>
{
var
advertisData
=
device
.
advertisData
;
if
(
advertisData
&&
typeof
advertisData
!==
'
string
'
)
{
device
.
advertisData
=
arrayBufferToBase64$2
(
advertisData
);
}
return
device
});
}
var
onBluetoothAdapterStateChange
;
var
onBluetoothDeviceFound
;
var
onBLEConnectionStateChange
;
...
...
@@ -4020,7 +4005,7 @@ var serviceContext = (function () {
}
function
startBluetoothDevicesDiscovery
(
data
,
callbackId
)
{
onBluetoothDeviceFound
=
onBluetoothDeviceFound
||
bluetoothOn
(
'
onBluetoothDeviceFound
'
,
checkDevices
);
onBluetoothDeviceFound
=
onBluetoothDeviceFound
||
bluetoothOn
(
'
onBluetoothDeviceFound
'
);
bluetoothExec
(
'
startBluetoothDevicesDiscovery
'
,
callbackId
,
data
);
}
...
...
@@ -4029,7 +4014,7 @@ var serviceContext = (function () {
}
function
getBluetoothDevices
(
data
,
callbackId
)
{
bluetoothExec
(
'
getBluetoothDevices
'
,
callbackId
,
{}
,
checkDevices
);
bluetoothExec
(
'
getBluetoothDevices
'
,
callbackId
,
{});
}
function
getConnectedBluetoothDevices
(
data
,
callbackId
)
{
...
...
@@ -4055,18 +4040,12 @@ var serviceContext = (function () {
}
function
notifyBLECharacteristicValueChange
(
data
,
callbackId
)
{
onBLECharacteristicValueChange
=
onBLECharacteristicValueChange
||
bluetoothOn
(
'
onBLECharacteristicValueChange
'
,
data
=>
{
data
.
value
=
arrayBufferToBase64$2
(
data
.
value
);
});
onBLECharacteristicValueChange
=
onBLECharacteristicValueChange
||
bluetoothOn
(
'
onBLECharacteristicValueChange
'
);
bluetoothExec
(
'
notifyBLECharacteristicValueChange
'
,
callbackId
,
data
);
}
function
notifyBLECharacteristicValueChanged
(
data
,
callbackId
)
{
onBLECharacteristicValueChange
=
onBLECharacteristicValueChange
||
bluetoothOn
(
'
onBLECharacteristicValueChange
'
,
data
=>
{
data
.
value
=
arrayBufferToBase64$2
(
data
.
value
);
});
onBLECharacteristicValueChange
=
onBLECharacteristicValueChange
||
bluetoothOn
(
'
onBLECharacteristicValueChange
'
);
bluetoothExec
(
'
notifyBLECharacteristicValueChanged
'
,
callbackId
,
data
);
}
...
...
@@ -4076,9 +4055,6 @@ var serviceContext = (function () {
}
function
writeBLECharacteristicValue
(
data
,
callbackId
)
{
if
(
typeof
data
.
value
===
'
string
'
)
{
data
.
value
=
base64ToArrayBuffer$2
(
data
.
value
);
}
bluetoothExec
(
'
writeBLECharacteristicValue
'
,
callbackId
,
data
);
}
...
...
@@ -4933,16 +4909,6 @@ var serviceContext = (function () {
}
}
var
safeAreaInsets
=
{
get
bottom
()
{
if
(
plus
.
os
.
name
===
'
iOS
'
)
{
const
safeArea
=
plus
.
navigator
.
getSafeAreaInsets
();
return
safeArea
?
safeArea
.
bottom
:
0
}
return
0
}
};
const
TABBAR_HEIGHT
=
50
;
const
isIOS$1
=
plus
.
os
.
name
===
'
iOS
'
;
let
config
;
...
...
@@ -5098,7 +5064,7 @@ var serviceContext = (function () {
return
visible
},
get
height
()
{
return
(
config
&&
config
.
height
?
parseFloat
(
config
.
height
)
:
TABBAR_HEIGHT
)
+
safeAreaInsets
.
b
ottom
return
(
config
&&
config
.
height
?
parseFloat
(
config
.
height
)
:
TABBAR_HEIGHT
)
+
plus
.
navigator
.
getSafeAreaInsets
().
deviceB
ottom
},
// tabBar是否遮挡内容区域
get
cover
()
{
...
...
@@ -7338,15 +7304,15 @@ var serviceContext = (function () {
}
const
callbacks$3
=
[];
// 不使用uni-core/service/platform中的onMethod,避免循环引用
UniServiceJSBridge
.
on
(
'
api.uniMPNativeEvent
'
,
function
(
res
)
{
callbacks$3
.
forEach
(
callbackId
=>
{
invoke$1
(
callbackId
,
res
.
event
,
res
.
data
);
});
});
function
onNativeEventReceive
(
callback
)
{
isFn
(
callback
)
&&
callbacks$3
.
indexOf
(
callback
)
===
-
1
&&
callbacks$3
.
push
(
callback
);
}
function
consumeNativeEvent
(
event
,
data
)
{
callbacks$3
.
forEach
(
callback
=>
callback
(
event
,
data
));
function
onNativeEventReceive
(
callbackId
)
{
callbacks$3
.
push
(
callbackId
);
}
function
sendNativeEvent
(
event
,
data
,
callback
)
{
...
...
@@ -9486,7 +9452,6 @@ var serviceContext = (function () {
getSubNVueById
:
getSubNVueById
,
getCurrentSubNVue
:
getCurrentSubNVue
,
onNativeEventReceive
:
onNativeEventReceive
,
consumeNativeEvent
:
consumeNativeEvent
,
sendNativeEvent
:
sendNativeEvent
,
navigateBack
:
navigateBack$1
,
navigateTo
:
navigateTo$1
,
...
...
@@ -12571,11 +12536,8 @@ var serviceContext = (function () {
});
});
globalEvent
.
addEventListener
(
'
uniMPNativeEvent
'
,
function
({
event
,
data
})
{
consumeNativeEvent
(
event
,
data
);
globalEvent
.
addEventListener
(
'
uniMPNativeEvent
'
,
function
(
event
)
{
publish
(
'
uniMPNativeEvent
'
,
event
);
});
plus
.
globalEvent
.
addEventListener
(
'
plusMessage
'
,
onPlusMessage$1
);
...
...
@@ -12890,7 +12852,7 @@ var serviceContext = (function () {
const
isAndroid
=
plus
.
os
.
name
.
toLowerCase
()
===
'
android
'
;
const
FOCUS_TIMEOUT
=
isAndroid
?
300
:
700
;
const
HIDE_TIMEOUT
=
8
00
;
const
HIDE_TIMEOUT
=
isAndroid
?
800
:
3
00
;
let
keyboardHeight
=
0
;
let
onKeyboardShow
;
let
focusTimer
;
...
...
@@ -13075,16 +13037,12 @@ var serviceContext = (function () {
removeElement
(
elm
)
{
const
elmIndex
=
this
.
elements
.
indexOf
(
elm
);
if
(
elmIndex
===
-
1
)
{
return
console
.
error
(
`removeElement[
${
elm
.
cid
}
][
${
elm
.
nid
}
] not found`
)
}
this
.
elements
.
splice
(
elmIndex
,
1
);
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
error
(
`removeElement[
${
elm
.
cid
}
][
${
elm
.
nid
}
] not found`
);
}
removeElementByCid
(
cid
)
{
if
(
!
cid
)
{
return
}
this
.
elements
=
this
.
elements
.
filter
(
elm
=>
elm
.
cid
!==
cid
);
this
.
elements
.
splice
(
elmIndex
,
1
);
}
push
(
type
,
cid
,
data
,
options
)
{
...
...
@@ -13172,6 +13130,22 @@ var serviceContext = (function () {
}
}
function
generateId
(
vm
,
parent
)
{
if
(
!
vm
.
$parent
)
{
return
'
-1
'
}
const
vnode
=
vm
.
$vnode
;
const
context
=
vnode
.
context
;
// slot 内的组件,需要补充 context 的 id,否则可能与内部组件索引值一致,导致 id 冲突
if
(
context
&&
context
!==
parent
&&
context
.
_$id
)
{
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
log
(
'
generateId:
'
+
context
.
_$id
+
'
;
'
+
parent
.
_$id
+
'
,
'
+
vnode
.
data
.
attrs
.
_i
);
}
return
context
.
_$id
+
'
;
'
+
parent
.
_$id
+
'
,
'
+
vnode
.
data
.
attrs
.
_i
}
return
parent
.
_$id
+
'
,
'
+
vnode
.
data
.
attrs
.
_i
}
function
setResult
(
data
,
k
,
v
)
{
data
[
k
]
=
v
;
}
...
...
@@ -13279,10 +13253,7 @@ var serviceContext = (function () {
if
(
!
this
.
_$vd
)
{
return
}
// TODO 自定义组件中的 slot 数据采集是在组件内部,导致所在 context 中无法获取到差量数据
// 如何保证每个 vm 数据有变动,就加入 diff 中呢?
// 每次变化,可能触发多次 beforeUpdate,updated
// 子组件 updated 时,可能会增加父组件的 diffData,如 slot 等情况
diff
(
this
.
_$newData
,
this
.
_$data
,
this
.
_$vdUpdatedData
);
this
.
_$data
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
_$newData
));
// setTimeout 一下再 nextTick( 直接 nextTick 的话,会紧接着该 updated 做 flush,导致父组件 updated 数据被丢弃)
...
...
@@ -13309,11 +13280,7 @@ var serviceContext = (function () {
this
.
_$vdomSync
=
new
VDomSync
(
this
.
$options
.
pageId
,
this
.
$options
.
pagePath
,
this
);
}
if
(
this
.
_$vd
)
{
if
(
!
this
.
$parent
)
{
this
.
_$id
=
'
-1
'
;
}
else
{
this
.
_$id
=
this
.
$parent
.
_$id
+
'
,
'
+
this
.
$vnode
.
data
.
attrs
.
_i
;
}
this
.
_$id
=
generateId
(
this
,
this
.
$parent
);
this
.
_$vd
.
addVm
(
this
);
this
.
_$vdMountedData
=
Object
.
create
(
null
);
this
.
_$setData
(
MOUNTED_DATA
,
this
.
_$vdMountedData
);
...
...
packages/uni-app-plus/dist/service.runtime.esm.dev.js
浏览文件 @
95c21b23
...
...
@@ -5489,93 +5489,236 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
Vue
.
version
=
'
2.6.11
'
;
/* */
var
nextNodeRef
=
1
;
// these are reserved for web because they are directly compiled away
// during template compilation
var
isReservedAttr
=
makeMap
(
'
style,class
'
);
function
uniqueId
()
{
return
(
nextNodeRef
++
).
toString
()
}
// attributes that should be using props for binding
var
acceptValue
=
makeMap
(
'
input,textarea,option,select,progress
'
);
var
Node
=
function
Node
()
{
this
.
nodeId
=
uniqueId
();
this
.
ref
=
this
.
nodeId
;
this
.
children
=
[];
this
.
pureChildren
=
[];
this
.
parentNode
=
null
;
this
.
nextSibling
=
null
;
this
.
previousSibling
=
null
;
};
var
isEnumeratedAttr
=
makeMap
(
'
contenteditable,draggable,spellcheck
'
);
Node
.
prototype
.
destroy
=
function
destroy
()
{
this
.
_$vd
&&
this
.
_$vd
.
removeElement
(
this
);
this
.
children
.
forEach
(
function
(
child
)
{
child
.
destroy
();
});
};
var
isValidContentEditableValue
=
makeMap
(
'
events,caret,typing,plaintext-only
'
);
var
Comment
=
/*@__PURE__*/
(
function
(
Node$$1
)
{
function
Comment
(
value
)
{
Node$$1
.
call
(
this
);
var
isBooleanAttr
=
makeMap
(
'
allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,
'
+
'
default,defaultchecked,defaultmuted,defaultselected,defer,disabled,
'
+
'
enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,
'
+
'
muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,
'
+
'
required,reversed,scoped,seamless,selected,sortable,translate,
'
+
'
truespeed,typemustmatch,visible
'
);
this
.
nodeType
=
8
;
this
.
nodeId
=
uniqueId
();
this
.
ref
=
this
.
nodeId
;
this
.
type
=
'
comment
'
;
this
.
value
=
value
;
this
.
children
=
[];
this
.
pureChildren
=
[];
}
/* */
if
(
Node$$1
)
Comment
.
__proto__
=
Node$$1
;
Comment
.
prototype
=
Object
.
create
(
Node$$1
&&
Node$$1
.
prototype
);
Comment
.
prototype
.
constructor
=
Comment
;
var
isReservedTag
=
makeMap
(
'
html,body,base,head,link,meta,style,title,
'
+
'
address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,
'
+
'
div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,
'
+
'
a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,
'
+
'
s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,
'
+
'
embed,object,param,source,canvas,script,noscript,del,ins,
'
+
'
caption,col,colgroup,table,thead,tbody,td,th,tr,
'
+
'
button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,
'
+
'
output,progress,select,textarea,
'
+
'
details,dialog,menu,menuitem,summary,
'
+
'
content,element,shadow,template,blockquote,iframe,tfoot
'
);
Comment
.
prototype
.
toString
=
function
toString
()
{
return
'
<!--
'
+
this
.
value
+
'
-->
'
};
function
mustUseProp$1
()
{
return
false
return
Comment
;
}(
Node
));
function
appendBody
(
doc
,
node
,
before
)
{
var
documentElement
=
doc
.
documentElement
;
if
(
documentElement
.
pureChildren
.
length
>
0
||
node
.
parentNode
)
{
return
}
var
children
=
documentElement
.
children
;
var
beforeIndex
=
children
.
indexOf
(
before
);
if
(
beforeIndex
<
0
)
{
children
.
push
(
node
);
}
else
{
children
.
splice
(
beforeIndex
,
0
,
node
);
}
if
(
node
.
nodeType
===
1
)
{
if
(
node
.
role
===
'
body
'
)
{
node
.
docId
=
doc
.
id
;
node
.
ownerDocument
=
doc
;
node
.
parentNode
=
documentElement
;
linkParent
(
node
,
documentElement
);
}
else
{
node
.
children
.
forEach
(
function
(
child
)
{
child
.
parentNode
=
node
;
});
setBody
(
doc
,
node
);
node
.
docId
=
doc
.
id
;
node
.
ownerDocument
=
doc
;
linkParent
(
node
,
documentElement
);
}
documentElement
.
pureChildren
.
push
(
node
);
}
else
{
node
.
parentNode
=
documentElement
;
}
}
function
getTagNamespace
()
{
}
function
setBody
(
doc
,
el
)
{
el
.
role
=
'
body
'
;
el
.
depth
=
1
;
el
.
ref
=
'
_root
'
;
doc
.
body
=
el
;
}
function
isUnknownElement
()
{
return
false
function
linkParent
(
node
,
parent
)
{
node
.
parentNode
=
parent
;
if
(
parent
.
docId
)
{
node
.
docId
=
parent
.
docId
;
node
.
ownerDocument
=
parent
.
ownerDocument
;
node
.
depth
=
parent
.
depth
+
1
;
}
node
.
children
.
forEach
(
function
(
child
)
{
linkParent
(
child
,
node
);
});
}
/* */
function
nextElement
(
node
)
{
while
(
node
)
{
if
(
node
.
nodeType
===
1
)
{
return
node
}
node
=
node
.
nextSibling
;
}
}
var
noop$1
=
{};
function
previousElement
(
node
)
{
while
(
node
)
{
if
(
node
.
nodeType
===
1
)
{
return
node
}
node
=
node
.
previousSibling
;
}
}
var
UniElement
=
function
UniElement
(
tagName
)
{
this
.
tagName
=
tagName
;
this
.
cid
=
''
;
this
.
nid
=
''
;
function
insertIndex
(
target
,
list
,
newIndex
,
changeSibling
)
{
if
(
newIndex
<
0
)
{
newIndex
=
0
;
}
var
before
=
list
[
newIndex
-
1
];
var
after
=
list
[
newIndex
];
list
.
splice
(
newIndex
,
0
,
target
);
if
(
changeSibling
)
{
before
&&
(
before
.
nextSibling
=
target
);
target
.
previousSibling
=
before
;
target
.
nextSibling
=
after
;
after
&&
(
after
.
previousSibling
=
target
);
}
return
newIndex
}
this
.
events
=
Object
.
create
(
null
);
};
function
moveIndex
(
target
,
list
,
newIndex
,
changeSibling
)
{
var
index
=
list
.
indexOf
(
target
);
if
(
index
<
0
)
{
return
-
1
}
if
(
changeSibling
)
{
var
before
=
list
[
index
-
1
];
var
after
=
list
[
index
+
1
];
before
&&
(
before
.
nextSibling
=
after
);
after
&&
(
after
.
previousSibling
=
before
);
}
list
.
splice
(
index
,
1
);
var
newIndexAfter
=
newIndex
;
if
(
index
<=
newIndex
)
{
newIndexAfter
=
newIndex
-
1
;
}
var
beforeNew
=
list
[
newIndexAfter
-
1
];
var
afterNew
=
list
[
newIndexAfter
];
list
.
splice
(
newIndexAfter
,
0
,
target
);
if
(
changeSibling
)
{
beforeNew
&&
(
beforeNew
.
nextSibling
=
target
);
target
.
previousSibling
=
beforeNew
;
target
.
nextSibling
=
afterNew
;
afterNew
&&
(
afterNew
.
previousSibling
=
target
);
}
if
(
index
===
newIndexAfter
)
{
return
-
1
}
return
newIndex
}
function
removeIndex
(
target
,
list
,
changeSibling
)
{
var
index
=
list
.
indexOf
(
target
);
if
(
index
<
0
)
{
return
}
if
(
changeSibling
)
{
var
before
=
list
[
index
-
1
];
var
after
=
list
[
index
+
1
];
before
&&
(
before
.
nextSibling
=
after
);
after
&&
(
after
.
previousSibling
=
before
);
}
list
.
splice
(
index
,
1
);
}
var
DEFAULT_TAG_NAME
=
'
view
'
;
var
Element
=
/*@__PURE__*/
(
function
(
Node$$1
)
{
function
Element
(
type
)
{
if
(
type
===
void
0
)
type
=
DEFAULT_TAG_NAME
;
Node$$1
.
call
(
this
);
this
.
nodeType
=
1
;
this
.
nodeId
=
uniqueId
();
this
.
ref
=
this
.
nodeId
;
this
.
type
=
type
;
this
.
attr
=
{};
this
.
events
=
{};
this
.
children
=
[];
this
.
pureChildren
=
[];
}
if
(
Node$$1
)
Element
.
__proto__
=
Node$$1
;
Element
.
prototype
=
Object
.
create
(
Node$$1
&&
Node$$1
.
prototype
);
Element
.
prototype
.
constructor
=
Element
;
Uni
Element
.
prototype
.
setAttribute
=
function
setAttribute
(
key
,
value
)
{
Element
.
prototype
.
setAttribute
=
function
setAttribute
(
key
,
value
)
{
if
(
key
===
'
cid
'
)
{
this
.
cid
=
value
;
}
else
if
(
key
===
'
nid
'
)
{
this
.
nid
=
value
;
}
};
};
Uni
Element
.
prototype
.
dispatchEvent
=
function
dispatchEvent
(
name
,
target
)
{
Element
.
prototype
.
dispatchEvent
=
function
dispatchEvent
(
name
,
target
)
{
var
handlers
=
this
.
events
[
name
];
if
(
!
handlers
)
{
console
.
error
((
"
cid=
"
+
(
this
.
cid
)
+
"
,nid=
"
+
(
this
.
nid
)
+
"
dispatchEvent(
"
+
name
+
"
) not found
"
));
return
}
handlers
.
forEach
(
function
(
handler
)
{
handler
(
target
);
});
};
};
Uni
Element
.
prototype
.
addEventListener
=
function
addEventListener
(
name
,
handler
)
{
Element
.
prototype
.
addEventListener
=
function
addEventListener
(
name
,
handler
)
{
if
(
this
.
cid
===
''
||
this
.
nid
===
''
)
{
return
console
.
error
((
"
cid=
"
+
(
this
.
cid
)
+
"
,nid=
"
+
(
this
.
nid
)
+
"
addEventListener(
"
+
name
+
"
) not found
"
))
}
(
this
.
events
[
name
]
||
(
this
.
events
[
name
]
=
[])).
push
(
handler
);
this
.
_$vd
.
addElement
(
this
);
};
};
Uni
Element
.
prototype
.
removeEventListener
=
function
removeEventListener
(
name
,
handler
)
{
Element
.
prototype
.
removeEventListener
=
function
removeEventListener
(
name
,
handler
)
{
var
this
$1
=
this
;
if
(
this
.
cid
===
''
||
this
.
nid
===
''
)
{
...
...
@@ -5595,53 +5738,305 @@ UniElement.prototype.removeEventListener = function removeEventListener (name, h
Object
.
keys
(
this
.
events
).
every
(
function
(
eventType
)
{
return
this
$1
.
events
[
eventType
].
length
===
0
;
})
&&
this
.
_$vd
.
removeElement
(
this
);
};
Element
.
prototype
.
appendChild
=
function
appendChild
(
node
)
{
if
(
node
.
parentNode
&&
node
.
parentNode
!==
this
)
{
return
}
if
(
!
node
.
parentNode
)
{
// if ("development" !== 'production') {
// console.log(`[appendChild](${this.docId},${node.type},${node.ref}) ` +
// `Append <${node.type}> to <${this.type}> (${this.ref}).`)
// }
linkParent
(
node
,
this
);
insertIndex
(
node
,
this
.
children
,
this
.
children
.
length
,
true
);
if
(
node
.
nodeType
===
1
)
{
insertIndex
(
node
,
this
.
pureChildren
,
this
.
pureChildren
.
length
);
}
}
else
{
// if ("development" !== 'production') {
// console.log(`[appendChild](${this.docId},${node.type},${node.ref}) ` +
// `Move <${node.type}> to ${this.children.length} of <${this.type}> (${this.ref}).`)
// }
moveIndex
(
node
,
this
.
children
,
this
.
children
.
length
,
true
);
if
(
node
.
nodeType
===
1
)
{
moveIndex
(
node
,
this
.
pureChildren
,
this
.
pureChildren
.
length
);
}
}
};
Element
.
prototype
.
insertBefore
=
function
insertBefore
(
node
,
before
)
{
if
(
node
.
parentNode
&&
node
.
parentNode
!==
this
)
{
return
}
if
(
node
===
before
||
(
node
.
nextSibling
&&
node
.
nextSibling
===
before
))
{
return
}
if
(
!
node
.
parentNode
)
{
// if ("development" !== 'production') {
// console.log(`[insertBefore](${this.docId},${node.type},${node.ref}) ` +
// `Insert <${node.type}> to <${this.type}> (${this.ref}), before (${before.ref}).`)
// }
linkParent
(
node
,
this
);
insertIndex
(
node
,
this
.
children
,
this
.
children
.
indexOf
(
before
),
true
);
if
(
node
.
nodeType
===
1
)
{
var
pureBefore
=
nextElement
(
before
);
insertIndex
(
node
,
this
.
pureChildren
,
pureBefore
?
this
.
pureChildren
.
indexOf
(
pureBefore
)
:
this
.
pureChildren
.
length
);
}
}
else
{
moveIndex
(
node
,
this
.
children
,
this
.
children
.
indexOf
(
before
),
true
);
if
(
node
.
nodeType
===
1
)
{
var
pureBefore$1
=
nextElement
(
before
);
moveIndex
(
node
,
this
.
pureChildren
,
pureBefore$1
?
this
.
pureChildren
.
indexOf
(
pureBefore$1
)
:
this
.
pureChildren
.
length
);
}
}
};
Element
.
prototype
.
insertAfter
=
function
insertAfter
(
node
,
after
)
{
if
(
node
.
parentNode
&&
node
.
parentNode
!==
this
)
{
return
}
if
(
node
===
after
||
(
node
.
previousSibling
&&
node
.
previousSibling
===
after
))
{
return
}
if
(
!
node
.
parentNode
)
{
// if ("development" !== 'production') {
// console.log(`[insertAfter](${this.docId},${node.type},${node.ref}) ` +
// `Insert <${node.type}> to <${this.type}> (${this.ref}), after (${after.ref}).`)
// }
linkParent
(
node
,
this
);
insertIndex
(
node
,
this
.
children
,
this
.
children
.
indexOf
(
after
)
+
1
,
true
);
if
(
node
.
nodeType
===
1
)
{
insertIndex
(
node
,
this
.
pureChildren
,
this
.
pureChildren
.
indexOf
(
previousElement
(
after
))
+
1
);
}
}
else
{
moveIndex
(
node
,
this
.
children
,
this
.
children
.
indexOf
(
after
)
+
1
,
true
);
if
(
node
.
nodeType
===
1
)
{
moveIndex
(
node
,
this
.
pureChildren
,
this
.
pureChildren
.
indexOf
(
previousElement
(
after
))
+
1
);
}
}
};
Element
.
prototype
.
removeChild
=
function
removeChild
(
node
,
preserved
)
{
if
(
node
.
parentNode
)
{
removeIndex
(
node
,
this
.
children
,
true
);
if
(
node
.
nodeType
===
1
)
{
// if ("development" !== 'production') {
// console.log(`[removeChild](${this.docId},${node.type},${node.ref}) ` +
// `Remove <${node.type}> from <${this.type}> (${this.ref}).`)
// }
removeIndex
(
node
,
this
.
pureChildren
);
}
}
if
(
!
preserved
)
{
node
.
destroy
();
}
};
Element
.
prototype
.
clear
=
function
clear
()
{
this
.
children
.
forEach
(
function
(
node
)
{
node
.
destroy
();
});
this
.
children
.
length
=
0
;
this
.
pureChildren
.
length
=
0
;
};
Element
.
prototype
.
toString
=
function
toString
()
{
return
'
<
'
+
this
.
type
+
'
attr=
'
+
JSON
.
stringify
(
this
.
attr
)
+
'
style=
'
+
JSON
.
stringify
(
this
.
toStyle
())
+
'
>
'
+
this
.
pureChildren
.
map
(
function
(
child
)
{
return
child
.
toString
();
}).
join
(
''
)
+
'
</
'
+
this
.
type
+
'
>
'
};
return
Element
;
}(
Node
));
var
Document
=
function
Document
(
id
,
url
)
{
this
.
id
=
id
?
id
.
toString
()
:
''
;
this
.
URL
=
url
;
this
.
createDocumentElement
();
};
Document
.
prototype
.
createDocumentElement
=
function
createDocumentElement
()
{
var
this
$1
=
this
;
if
(
!
this
.
documentElement
)
{
var
el
=
new
Element
(
'
document
'
);
el
.
docId
=
this
.
id
;
el
.
ownerDocument
=
this
;
el
.
role
=
'
documentElement
'
;
el
.
depth
=
0
;
el
.
ref
=
'
_documentElement
'
;
this
.
documentElement
=
el
;
Object
.
defineProperty
(
el
,
'
appendChild
'
,
{
configurable
:
true
,
enumerable
:
true
,
writable
:
true
,
value
:
function
(
node
)
{
appendBody
(
this
$1
,
node
);
}
});
Object
.
defineProperty
(
el
,
'
insertBefore
'
,
{
configurable
:
true
,
enumerable
:
true
,
writable
:
true
,
value
:
function
(
node
,
before
)
{
appendBody
(
this
$1
,
node
,
before
);
}
});
// if ("development" !== 'production') {
// console.log(`Create document element (id: "${el.docId}", ref: "${el.ref}")`)
// }
}
return
this
.
documentElement
};
Document
.
prototype
.
createBody
=
function
createBody
(
type
)
{
if
(
!
this
.
body
)
{
var
el
=
new
Element
(
type
);
setBody
(
this
,
el
);
// if ("development" !== 'production') {
// console.log(`[createBody](${this.id},${el.type},${el.ref}) ` +
// `(${JSON.stringify(el.toJSON(true))}).`)
// }
}
return
this
.
body
};
Document
.
prototype
.
createElement
=
function
createElement
(
tagName
)
{
var
el
=
new
Element
(
tagName
);
// if ("development" !== 'production') {
// console.log(`[createElement](${this.id},${el.type},${el.ref}) ` +
// `(${JSON.stringify(el.toJSON(true))}).`)
// }
return
el
};
Document
.
prototype
.
createComment
=
function
createComment
(
text
)
{
return
new
Comment
(
text
)
};
Document
.
prototype
.
destroy
=
function
destroy
()
{
// if ("development" !== 'production') {
// console.log(`[destroy](${this.id},document,${this.ref}) ` +
// `Destroy document (id: "${this.id}", URL: "${this.URL}")`)
// }
};
/* */
// these are reserved for web because they are directly compiled away
// during template compilation
var
isReservedAttr
=
makeMap
(
'
style,class
'
);
// attributes that should be using props for binding
var
acceptValue
=
makeMap
(
'
input,textarea,option,select,progress
'
);
var
isEnumeratedAttr
=
makeMap
(
'
contenteditable,draggable,spellcheck
'
);
var
isValidContentEditableValue
=
makeMap
(
'
events,caret,typing,plaintext-only
'
);
var
isBooleanAttr
=
makeMap
(
'
allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,
'
+
'
default,defaultchecked,defaultmuted,defaultselected,defer,disabled,
'
+
'
enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,
'
+
'
muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,
'
+
'
required,reversed,scoped,seamless,selected,sortable,translate,
'
+
'
truespeed,typemustmatch,visible
'
);
/* */
var
isReservedTag
=
makeMap
(
'
html,body,base,head,link,meta,style,title,
'
+
'
address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,
'
+
'
div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,
'
+
'
a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,
'
+
'
s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,
'
+
'
embed,object,param,source,canvas,script,noscript,del,ins,
'
+
'
caption,col,colgroup,table,thead,tbody,td,th,tr,
'
+
'
button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,
'
+
'
output,progress,select,textarea,
'
+
'
details,dialog,menu,menuitem,summary,
'
+
'
content,element,shadow,template,blockquote,iframe,tfoot
'
);
function
mustUseProp$1
()
{
return
false
}
function
getTagNamespace
()
{
}
function
isUnknownElement
()
{
return
false
}
/* */
function
createElement$1
(
tagName
)
{
return
new
Uni
Element
(
tagName
)
return
new
Element
(
tagName
)
}
function
createElementNS
(
namespace
,
tagName
)
{
return
new
UniElement
(
tagName
)
return
new
Element
(
namespace
+
'
:
'
+
tagName
)
}
function
createTextNode
()
{
return
n
oop$1
return
n
ew
Element
(
'
text
'
)
}
function
createComment
()
{
return
n
oop$1
function
createComment
(
text
)
{
return
n
ew
Comment
(
text
)
}
function
insertBefore
()
{
function
insertBefore
(
node
,
target
,
before
)
{
node
.
insertBefore
(
target
,
before
);
}
function
removeChild
(
node
,
child
)
{
if
(
!
child
)
{
return
}
if
(
child
.
__vue__
&&
child
.
__vue__
.
_$vd
)
{
// 根据组件cid删除所有相关element,后续应该建立一套完整的DOM逻辑
child
.
__vue__
.
_$vd
.
removeElementByCid
(
child
.
__vue__
.
_$id
);
}
child
.
_$vd
&&
child
.
_$vd
.
removeElement
(
child
);
node
.
removeChild
(
child
);
}
function
appendChild
()
{
function
appendChild
(
node
,
child
)
{
node
.
appendChild
(
child
);
}
function
parentNode
()
{
return
no
op$1
function
parentNode
(
node
)
{
return
no
de
.
parentNode
}
function
nextSibling
()
{
return
no
op$1
function
nextSibling
(
node
)
{
return
no
de
.
nextSibling
}
function
tagName
()
{
return
'
view
'
function
tagName
(
node
)
{
return
node
.
type
}
function
setTextContent
()
{}
...
...
@@ -6798,7 +7193,16 @@ function updateDOMListeners (oldVnode, vnode) {
target$1
.
_$vd
=
vnode
.
context
.
_$vd
;
var
context
=
vnode
.
context
;
// 存储事件标记
target$1
.
setAttribute
(
'
nid
'
,
String
((
vnode
.
data
.
attrs
||
{})[
'
_i
'
]));
var
nid
=
(
vnode
.
data
.
attrs
||
{})[
'
_i
'
];
var
parent
=
vnode
.
parent
;
while
(
parent
&&
parent
.
componentInstance
)
{
// 使用组件外壳节点id
var
parentId
=
parent
.
data
.
attrs
&&
parent
.
data
.
attrs
[
'
_i
'
];
isDef
(
parentId
)
&&
(
nid
=
'
r-
'
+
parentId
);
parent
=
parent
.
parent
;
}
target$1
.
setAttribute
(
'
nid
'
,
String
(
nid
));
target$1
.
setAttribute
(
'
cid
'
,
context
.
_$id
);
normalizeEvents
(
on
);
...
...
@@ -6953,6 +7357,12 @@ Vue.prototype.$mount = function (
el
,
hydrating
)
{
if
(
this
.
$options
.
mpType
===
'
page
'
)
{
var
doc
=
new
Document
(
this
.
$options
.
pageId
,
this
.
$options
.
pagePath
);
el
=
doc
.
createComment
(
'
root
'
);
el
.
hasAttribute
=
el
.
removeAttribute
=
function
(){};
// hack for patch
doc
.
documentElement
.
appendChild
(
el
);
}
return
mountComponent
(
this
,
el
,
hydrating
)
};
Vue
.
use
(
plugin
);
...
...
packages/uni-app-plus/dist/service.runtime.esm.prod.js
浏览文件 @
95c21b23
...
...
@@ -4745,93 +4745,236 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
Vue
.
version
=
'
2.6.11
'
;
/* */
var
nextNodeRef
=
1
;
// these are reserved for web because they are directly compiled away
// during template compilation
var
isReservedAttr
=
makeMap
(
'
style,class
'
);
function
uniqueId
()
{
return
(
nextNodeRef
++
).
toString
()
}
// attributes that should be using props for binding
var
acceptValue
=
makeMap
(
'
input,textarea,option,select,progress
'
);
var
Node
=
function
Node
()
{
this
.
nodeId
=
uniqueId
();
this
.
ref
=
this
.
nodeId
;
this
.
children
=
[];
this
.
pureChildren
=
[];
this
.
parentNode
=
null
;
this
.
nextSibling
=
null
;
this
.
previousSibling
=
null
;
};
var
isEnumeratedAttr
=
makeMap
(
'
contenteditable,draggable,spellcheck
'
);
Node
.
prototype
.
destroy
=
function
destroy
()
{
this
.
_$vd
&&
this
.
_$vd
.
removeElement
(
this
);
this
.
children
.
forEach
(
function
(
child
)
{
child
.
destroy
();
});
};
var
isValidContentEditableValue
=
makeMap
(
'
events,caret,typing,plaintext-only
'
);
var
Comment
=
/*@__PURE__*/
(
function
(
Node$$1
)
{
function
Comment
(
value
)
{
Node$$1
.
call
(
this
);
var
isBooleanAttr
=
makeMap
(
'
allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,
'
+
'
default,defaultchecked,defaultmuted,defaultselected,defer,disabled,
'
+
'
enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,
'
+
'
muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,
'
+
'
required,reversed,scoped,seamless,selected,sortable,translate,
'
+
'
truespeed,typemustmatch,visible
'
);
this
.
nodeType
=
8
;
this
.
nodeId
=
uniqueId
();
this
.
ref
=
this
.
nodeId
;
this
.
type
=
'
comment
'
;
this
.
value
=
value
;
this
.
children
=
[];
this
.
pureChildren
=
[];
}
/* */
if
(
Node$$1
)
Comment
.
__proto__
=
Node$$1
;
Comment
.
prototype
=
Object
.
create
(
Node$$1
&&
Node$$1
.
prototype
);
Comment
.
prototype
.
constructor
=
Comment
;
var
isReservedTag
=
makeMap
(
'
html,body,base,head,link,meta,style,title,
'
+
'
address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,
'
+
'
div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,
'
+
'
a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,
'
+
'
s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,
'
+
'
embed,object,param,source,canvas,script,noscript,del,ins,
'
+
'
caption,col,colgroup,table,thead,tbody,td,th,tr,
'
+
'
button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,
'
+
'
output,progress,select,textarea,
'
+
'
details,dialog,menu,menuitem,summary,
'
+
'
content,element,shadow,template,blockquote,iframe,tfoot
'
);
Comment
.
prototype
.
toString
=
function
toString
()
{
return
'
<!--
'
+
this
.
value
+
'
-->
'
};
function
mustUseProp$1
()
{
return
false
return
Comment
;
}(
Node
));
function
appendBody
(
doc
,
node
,
before
)
{
var
documentElement
=
doc
.
documentElement
;
if
(
documentElement
.
pureChildren
.
length
>
0
||
node
.
parentNode
)
{
return
}
var
children
=
documentElement
.
children
;
var
beforeIndex
=
children
.
indexOf
(
before
);
if
(
beforeIndex
<
0
)
{
children
.
push
(
node
);
}
else
{
children
.
splice
(
beforeIndex
,
0
,
node
);
}
if
(
node
.
nodeType
===
1
)
{
if
(
node
.
role
===
'
body
'
)
{
node
.
docId
=
doc
.
id
;
node
.
ownerDocument
=
doc
;
node
.
parentNode
=
documentElement
;
linkParent
(
node
,
documentElement
);
}
else
{
node
.
children
.
forEach
(
function
(
child
)
{
child
.
parentNode
=
node
;
});
setBody
(
doc
,
node
);
node
.
docId
=
doc
.
id
;
node
.
ownerDocument
=
doc
;
linkParent
(
node
,
documentElement
);
}
documentElement
.
pureChildren
.
push
(
node
);
}
else
{
node
.
parentNode
=
documentElement
;
}
}
function
getTagNamespace
()
{
}
function
setBody
(
doc
,
el
)
{
el
.
role
=
'
body
'
;
el
.
depth
=
1
;
el
.
ref
=
'
_root
'
;
doc
.
body
=
el
;
}
function
isUnknownElement
()
{
return
false
function
linkParent
(
node
,
parent
)
{
node
.
parentNode
=
parent
;
if
(
parent
.
docId
)
{
node
.
docId
=
parent
.
docId
;
node
.
ownerDocument
=
parent
.
ownerDocument
;
node
.
depth
=
parent
.
depth
+
1
;
}
node
.
children
.
forEach
(
function
(
child
)
{
linkParent
(
child
,
node
);
});
}
/* */
function
nextElement
(
node
)
{
while
(
node
)
{
if
(
node
.
nodeType
===
1
)
{
return
node
}
node
=
node
.
nextSibling
;
}
}
var
noop$1
=
{};
function
previousElement
(
node
)
{
while
(
node
)
{
if
(
node
.
nodeType
===
1
)
{
return
node
}
node
=
node
.
previousSibling
;
}
}
var
UniElement
=
function
UniElement
(
tagName
)
{
this
.
tagName
=
tagName
;
this
.
cid
=
''
;
this
.
nid
=
''
;
function
insertIndex
(
target
,
list
,
newIndex
,
changeSibling
)
{
if
(
newIndex
<
0
)
{
newIndex
=
0
;
}
var
before
=
list
[
newIndex
-
1
];
var
after
=
list
[
newIndex
];
list
.
splice
(
newIndex
,
0
,
target
);
if
(
changeSibling
)
{
before
&&
(
before
.
nextSibling
=
target
);
target
.
previousSibling
=
before
;
target
.
nextSibling
=
after
;
after
&&
(
after
.
previousSibling
=
target
);
}
return
newIndex
}
this
.
events
=
Object
.
create
(
null
);
};
function
moveIndex
(
target
,
list
,
newIndex
,
changeSibling
)
{
var
index
=
list
.
indexOf
(
target
);
if
(
index
<
0
)
{
return
-
1
}
if
(
changeSibling
)
{
var
before
=
list
[
index
-
1
];
var
after
=
list
[
index
+
1
];
before
&&
(
before
.
nextSibling
=
after
);
after
&&
(
after
.
previousSibling
=
before
);
}
list
.
splice
(
index
,
1
);
var
newIndexAfter
=
newIndex
;
if
(
index
<=
newIndex
)
{
newIndexAfter
=
newIndex
-
1
;
}
var
beforeNew
=
list
[
newIndexAfter
-
1
];
var
afterNew
=
list
[
newIndexAfter
];
list
.
splice
(
newIndexAfter
,
0
,
target
);
if
(
changeSibling
)
{
beforeNew
&&
(
beforeNew
.
nextSibling
=
target
);
target
.
previousSibling
=
beforeNew
;
target
.
nextSibling
=
afterNew
;
afterNew
&&
(
afterNew
.
previousSibling
=
target
);
}
if
(
index
===
newIndexAfter
)
{
return
-
1
}
return
newIndex
}
function
removeIndex
(
target
,
list
,
changeSibling
)
{
var
index
=
list
.
indexOf
(
target
);
if
(
index
<
0
)
{
return
}
if
(
changeSibling
)
{
var
before
=
list
[
index
-
1
];
var
after
=
list
[
index
+
1
];
before
&&
(
before
.
nextSibling
=
after
);
after
&&
(
after
.
previousSibling
=
before
);
}
list
.
splice
(
index
,
1
);
}
var
DEFAULT_TAG_NAME
=
'
view
'
;
var
Element
=
/*@__PURE__*/
(
function
(
Node$$1
)
{
function
Element
(
type
)
{
if
(
type
===
void
0
)
type
=
DEFAULT_TAG_NAME
;
Node$$1
.
call
(
this
);
this
.
nodeType
=
1
;
this
.
nodeId
=
uniqueId
();
this
.
ref
=
this
.
nodeId
;
this
.
type
=
type
;
this
.
attr
=
{};
this
.
events
=
{};
this
.
children
=
[];
this
.
pureChildren
=
[];
}
if
(
Node$$1
)
Element
.
__proto__
=
Node$$1
;
Element
.
prototype
=
Object
.
create
(
Node$$1
&&
Node$$1
.
prototype
);
Element
.
prototype
.
constructor
=
Element
;
Uni
Element
.
prototype
.
setAttribute
=
function
setAttribute
(
key
,
value
)
{
Element
.
prototype
.
setAttribute
=
function
setAttribute
(
key
,
value
)
{
if
(
key
===
'
cid
'
)
{
this
.
cid
=
value
;
}
else
if
(
key
===
'
nid
'
)
{
this
.
nid
=
value
;
}
};
};
Uni
Element
.
prototype
.
dispatchEvent
=
function
dispatchEvent
(
name
,
target
)
{
Element
.
prototype
.
dispatchEvent
=
function
dispatchEvent
(
name
,
target
)
{
var
handlers
=
this
.
events
[
name
];
if
(
!
handlers
)
{
console
.
error
((
"
cid=
"
+
(
this
.
cid
)
+
"
,nid=
"
+
(
this
.
nid
)
+
"
dispatchEvent(
"
+
name
+
"
) not found
"
));
return
}
handlers
.
forEach
(
function
(
handler
)
{
handler
(
target
);
});
};
};
Uni
Element
.
prototype
.
addEventListener
=
function
addEventListener
(
name
,
handler
)
{
Element
.
prototype
.
addEventListener
=
function
addEventListener
(
name
,
handler
)
{
if
(
this
.
cid
===
''
||
this
.
nid
===
''
)
{
return
console
.
error
((
"
cid=
"
+
(
this
.
cid
)
+
"
,nid=
"
+
(
this
.
nid
)
+
"
addEventListener(
"
+
name
+
"
) not found
"
))
}
(
this
.
events
[
name
]
||
(
this
.
events
[
name
]
=
[])).
push
(
handler
);
this
.
_$vd
.
addElement
(
this
);
};
};
Uni
Element
.
prototype
.
removeEventListener
=
function
removeEventListener
(
name
,
handler
)
{
Element
.
prototype
.
removeEventListener
=
function
removeEventListener
(
name
,
handler
)
{
var
this
$1
=
this
;
if
(
this
.
cid
===
''
||
this
.
nid
===
''
)
{
...
...
@@ -4851,53 +4994,305 @@ UniElement.prototype.removeEventListener = function removeEventListener (name, h
Object
.
keys
(
this
.
events
).
every
(
function
(
eventType
)
{
return
this
$1
.
events
[
eventType
].
length
===
0
;
})
&&
this
.
_$vd
.
removeElement
(
this
);
};
Element
.
prototype
.
appendChild
=
function
appendChild
(
node
)
{
if
(
node
.
parentNode
&&
node
.
parentNode
!==
this
)
{
return
}
if
(
!
node
.
parentNode
)
{
// if ("production" !== 'production') {
// console.log(`[appendChild](${this.docId},${node.type},${node.ref}) ` +
// `Append <${node.type}> to <${this.type}> (${this.ref}).`)
// }
linkParent
(
node
,
this
);
insertIndex
(
node
,
this
.
children
,
this
.
children
.
length
,
true
);
if
(
node
.
nodeType
===
1
)
{
insertIndex
(
node
,
this
.
pureChildren
,
this
.
pureChildren
.
length
);
}
}
else
{
// if ("production" !== 'production') {
// console.log(`[appendChild](${this.docId},${node.type},${node.ref}) ` +
// `Move <${node.type}> to ${this.children.length} of <${this.type}> (${this.ref}).`)
// }
moveIndex
(
node
,
this
.
children
,
this
.
children
.
length
,
true
);
if
(
node
.
nodeType
===
1
)
{
moveIndex
(
node
,
this
.
pureChildren
,
this
.
pureChildren
.
length
);
}
}
};
Element
.
prototype
.
insertBefore
=
function
insertBefore
(
node
,
before
)
{
if
(
node
.
parentNode
&&
node
.
parentNode
!==
this
)
{
return
}
if
(
node
===
before
||
(
node
.
nextSibling
&&
node
.
nextSibling
===
before
))
{
return
}
if
(
!
node
.
parentNode
)
{
// if ("production" !== 'production') {
// console.log(`[insertBefore](${this.docId},${node.type},${node.ref}) ` +
// `Insert <${node.type}> to <${this.type}> (${this.ref}), before (${before.ref}).`)
// }
linkParent
(
node
,
this
);
insertIndex
(
node
,
this
.
children
,
this
.
children
.
indexOf
(
before
),
true
);
if
(
node
.
nodeType
===
1
)
{
var
pureBefore
=
nextElement
(
before
);
insertIndex
(
node
,
this
.
pureChildren
,
pureBefore
?
this
.
pureChildren
.
indexOf
(
pureBefore
)
:
this
.
pureChildren
.
length
);
}
}
else
{
moveIndex
(
node
,
this
.
children
,
this
.
children
.
indexOf
(
before
),
true
);
if
(
node
.
nodeType
===
1
)
{
var
pureBefore$1
=
nextElement
(
before
);
moveIndex
(
node
,
this
.
pureChildren
,
pureBefore$1
?
this
.
pureChildren
.
indexOf
(
pureBefore$1
)
:
this
.
pureChildren
.
length
);
}
}
};
Element
.
prototype
.
insertAfter
=
function
insertAfter
(
node
,
after
)
{
if
(
node
.
parentNode
&&
node
.
parentNode
!==
this
)
{
return
}
if
(
node
===
after
||
(
node
.
previousSibling
&&
node
.
previousSibling
===
after
))
{
return
}
if
(
!
node
.
parentNode
)
{
// if ("production" !== 'production') {
// console.log(`[insertAfter](${this.docId},${node.type},${node.ref}) ` +
// `Insert <${node.type}> to <${this.type}> (${this.ref}), after (${after.ref}).`)
// }
linkParent
(
node
,
this
);
insertIndex
(
node
,
this
.
children
,
this
.
children
.
indexOf
(
after
)
+
1
,
true
);
if
(
node
.
nodeType
===
1
)
{
insertIndex
(
node
,
this
.
pureChildren
,
this
.
pureChildren
.
indexOf
(
previousElement
(
after
))
+
1
);
}
}
else
{
moveIndex
(
node
,
this
.
children
,
this
.
children
.
indexOf
(
after
)
+
1
,
true
);
if
(
node
.
nodeType
===
1
)
{
moveIndex
(
node
,
this
.
pureChildren
,
this
.
pureChildren
.
indexOf
(
previousElement
(
after
))
+
1
);
}
}
};
Element
.
prototype
.
removeChild
=
function
removeChild
(
node
,
preserved
)
{
if
(
node
.
parentNode
)
{
removeIndex
(
node
,
this
.
children
,
true
);
if
(
node
.
nodeType
===
1
)
{
// if ("production" !== 'production') {
// console.log(`[removeChild](${this.docId},${node.type},${node.ref}) ` +
// `Remove <${node.type}> from <${this.type}> (${this.ref}).`)
// }
removeIndex
(
node
,
this
.
pureChildren
);
}
}
if
(
!
preserved
)
{
node
.
destroy
();
}
};
Element
.
prototype
.
clear
=
function
clear
()
{
this
.
children
.
forEach
(
function
(
node
)
{
node
.
destroy
();
});
this
.
children
.
length
=
0
;
this
.
pureChildren
.
length
=
0
;
};
Element
.
prototype
.
toString
=
function
toString
()
{
return
'
<
'
+
this
.
type
+
'
attr=
'
+
JSON
.
stringify
(
this
.
attr
)
+
'
style=
'
+
JSON
.
stringify
(
this
.
toStyle
())
+
'
>
'
+
this
.
pureChildren
.
map
(
function
(
child
)
{
return
child
.
toString
();
}).
join
(
''
)
+
'
</
'
+
this
.
type
+
'
>
'
};
return
Element
;
}(
Node
));
var
Document
=
function
Document
(
id
,
url
)
{
this
.
id
=
id
?
id
.
toString
()
:
''
;
this
.
URL
=
url
;
this
.
createDocumentElement
();
};
Document
.
prototype
.
createDocumentElement
=
function
createDocumentElement
()
{
var
this
$1
=
this
;
if
(
!
this
.
documentElement
)
{
var
el
=
new
Element
(
'
document
'
);
el
.
docId
=
this
.
id
;
el
.
ownerDocument
=
this
;
el
.
role
=
'
documentElement
'
;
el
.
depth
=
0
;
el
.
ref
=
'
_documentElement
'
;
this
.
documentElement
=
el
;
Object
.
defineProperty
(
el
,
'
appendChild
'
,
{
configurable
:
true
,
enumerable
:
true
,
writable
:
true
,
value
:
function
(
node
)
{
appendBody
(
this
$1
,
node
);
}
});
Object
.
defineProperty
(
el
,
'
insertBefore
'
,
{
configurable
:
true
,
enumerable
:
true
,
writable
:
true
,
value
:
function
(
node
,
before
)
{
appendBody
(
this
$1
,
node
,
before
);
}
});
// if ("production" !== 'production') {
// console.log(`Create document element (id: "${el.docId}", ref: "${el.ref}")`)
// }
}
return
this
.
documentElement
};
Document
.
prototype
.
createBody
=
function
createBody
(
type
)
{
if
(
!
this
.
body
)
{
var
el
=
new
Element
(
type
);
setBody
(
this
,
el
);
// if ("production" !== 'production') {
// console.log(`[createBody](${this.id},${el.type},${el.ref}) ` +
// `(${JSON.stringify(el.toJSON(true))}).`)
// }
}
return
this
.
body
};
Document
.
prototype
.
createElement
=
function
createElement
(
tagName
)
{
var
el
=
new
Element
(
tagName
);
// if ("production" !== 'production') {
// console.log(`[createElement](${this.id},${el.type},${el.ref}) ` +
// `(${JSON.stringify(el.toJSON(true))}).`)
// }
return
el
};
Document
.
prototype
.
createComment
=
function
createComment
(
text
)
{
return
new
Comment
(
text
)
};
Document
.
prototype
.
destroy
=
function
destroy
()
{
// if ("production" !== 'production') {
// console.log(`[destroy](${this.id},document,${this.ref}) ` +
// `Destroy document (id: "${this.id}", URL: "${this.URL}")`)
// }
};
/* */
// these are reserved for web because they are directly compiled away
// during template compilation
var
isReservedAttr
=
makeMap
(
'
style,class
'
);
// attributes that should be using props for binding
var
acceptValue
=
makeMap
(
'
input,textarea,option,select,progress
'
);
var
isEnumeratedAttr
=
makeMap
(
'
contenteditable,draggable,spellcheck
'
);
var
isValidContentEditableValue
=
makeMap
(
'
events,caret,typing,plaintext-only
'
);
var
isBooleanAttr
=
makeMap
(
'
allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,
'
+
'
default,defaultchecked,defaultmuted,defaultselected,defer,disabled,
'
+
'
enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,
'
+
'
muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,
'
+
'
required,reversed,scoped,seamless,selected,sortable,translate,
'
+
'
truespeed,typemustmatch,visible
'
);
/* */
var
isReservedTag
=
makeMap
(
'
html,body,base,head,link,meta,style,title,
'
+
'
address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,
'
+
'
div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,
'
+
'
a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,
'
+
'
s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,
'
+
'
embed,object,param,source,canvas,script,noscript,del,ins,
'
+
'
caption,col,colgroup,table,thead,tbody,td,th,tr,
'
+
'
button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,
'
+
'
output,progress,select,textarea,
'
+
'
details,dialog,menu,menuitem,summary,
'
+
'
content,element,shadow,template,blockquote,iframe,tfoot
'
);
function
mustUseProp$1
()
{
return
false
}
function
getTagNamespace
()
{
}
function
isUnknownElement
()
{
return
false
}
/* */
function
createElement$1
(
tagName
)
{
return
new
Uni
Element
(
tagName
)
return
new
Element
(
tagName
)
}
function
createElementNS
(
namespace
,
tagName
)
{
return
new
UniElement
(
tagName
)
return
new
Element
(
namespace
+
'
:
'
+
tagName
)
}
function
createTextNode
()
{
return
n
oop$1
return
n
ew
Element
(
'
text
'
)
}
function
createComment
()
{
return
n
oop$1
function
createComment
(
text
)
{
return
n
ew
Comment
(
text
)
}
function
insertBefore
()
{
function
insertBefore
(
node
,
target
,
before
)
{
node
.
insertBefore
(
target
,
before
);
}
function
removeChild
(
node
,
child
)
{
if
(
!
child
)
{
return
}
if
(
child
.
__vue__
&&
child
.
__vue__
.
_$vd
)
{
// 根据组件cid删除所有相关element,后续应该建立一套完整的DOM逻辑
child
.
__vue__
.
_$vd
.
removeElementByCid
(
child
.
__vue__
.
_$id
);
}
child
.
_$vd
&&
child
.
_$vd
.
removeElement
(
child
);
node
.
removeChild
(
child
);
}
function
appendChild
()
{
function
appendChild
(
node
,
child
)
{
node
.
appendChild
(
child
);
}
function
parentNode
()
{
return
no
op$1
function
parentNode
(
node
)
{
return
no
de
.
parentNode
}
function
nextSibling
()
{
return
no
op$1
function
nextSibling
(
node
)
{
return
no
de
.
nextSibling
}
function
tagName
()
{
return
'
view
'
function
tagName
(
node
)
{
return
node
.
type
}
function
setTextContent
()
{}
...
...
@@ -5947,7 +6342,16 @@ function updateDOMListeners (oldVnode, vnode) {
target$1
.
_$vd
=
vnode
.
context
.
_$vd
;
var
context
=
vnode
.
context
;
// 存储事件标记
target$1
.
setAttribute
(
'
nid
'
,
String
((
vnode
.
data
.
attrs
||
{})[
'
_i
'
]));
var
nid
=
(
vnode
.
data
.
attrs
||
{})[
'
_i
'
];
var
parent
=
vnode
.
parent
;
while
(
parent
&&
parent
.
componentInstance
)
{
// 使用组件外壳节点id
var
parentId
=
parent
.
data
.
attrs
&&
parent
.
data
.
attrs
[
'
_i
'
];
isDef
(
parentId
)
&&
(
nid
=
'
r-
'
+
parentId
);
parent
=
parent
.
parent
;
}
target$1
.
setAttribute
(
'
nid
'
,
String
(
nid
));
target$1
.
setAttribute
(
'
cid
'
,
context
.
_$id
);
normalizeEvents
(
on
);
...
...
@@ -6102,6 +6506,12 @@ Vue.prototype.$mount = function (
el
,
hydrating
)
{
if
(
this
.
$options
.
mpType
===
'
page
'
)
{
var
doc
=
new
Document
(
this
.
$options
.
pageId
,
this
.
$options
.
pagePath
);
el
=
doc
.
createComment
(
'
root
'
);
el
.
hasAttribute
=
el
.
removeAttribute
=
function
(){};
// hack for patch
doc
.
documentElement
.
appendChild
(
el
);
}
return
mountComponent
(
this
,
el
,
hydrating
)
};
Vue
.
use
(
plugin
);
...
...
packages/uni-app-plus/dist/view.css
浏览文件 @
95c21b23
此差异已折叠。
点击以展开。
packages/uni-app-plus/dist/view.umd.min.js
浏览文件 @
95c21b23
此差异已折叠。
点击以展开。
packages/uni-cli-shared/components/navigation-bar.vue
浏览文件 @
95c21b23
...
...
@@ -103,7 +103,7 @@ export default {
this
.
_webview
=
page
.
$getAppWebview
()
attrs
.
forEach
(
key
=>
{
let
titleNView
=
{}
if
(
this
[
key
]
||
this
[
key
].
length
>
0
){
if
(
this
[
key
]
||
this
[
key
].
length
>
0
)
{
titleNView
[
key
]
=
this
[
key
]
}
this
.
setTitleNView
(
titleNView
)
...
...
packages/uni-migration/lib/index.js
浏览文件 @
95c21b23
...
...
@@ -13,7 +13,7 @@ module.exports = function migrate(input, out, options = {}) {
options
.
platform
=
options
.
platform
||
'
mp-weixin
'
const
migrater
=
migraters
[
options
.
platform
]
if
(
!
migrater
)
{
return
console
.
error
(
`错误: 目前支持
Object.keys(migraters).join(',')
转换`
)
return
console
.
error
(
`错误: 目前支持
${
Object
.
keys
(
migraters
).
join
(
'
,
'
)}
转换`
)
}
input
=
path
.
resolve
(
input
)
out
=
path
.
resolve
(
out
||
input
)
...
...
src/platforms/app-plus/helpers/util.js
0 → 100644
浏览文件 @
95c21b23
export
function
generateId
(
vm
,
parent
)
{
if
(
!
vm
.
$parent
)
{
return
'
-1
'
}
const
vnode
=
vm
.
$vnode
const
context
=
vnode
.
context
// slot 内的组件,需要补充 context 的 id,否则可能与内部组件索引值一致,导致 id 冲突
if
(
context
&&
context
!==
parent
&&
context
.
_$id
)
{
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
log
(
'
generateId:
'
+
context
.
_$id
+
'
;
'
+
parent
.
_$id
+
'
,
'
+
vnode
.
data
.
attrs
.
_i
)
}
return
context
.
_$id
+
'
;
'
+
parent
.
_$id
+
'
,
'
+
vnode
.
data
.
attrs
.
_i
}
return
parent
.
_$id
+
'
,
'
+
vnode
.
data
.
attrs
.
_i
}
src/platforms/app-plus/service/framework/plugins/data.js
浏览文件 @
95c21b23
...
...
@@ -23,6 +23,10 @@ import {
S_CLASS
}
from
'
../../constants
'
import
{
generateId
}
from
'
../../../helpers/util
'
import
{
diff
}
from
'
./diff
'
...
...
@@ -57,10 +61,7 @@ export function initData (Vue) {
if
(
!
this
.
_$vd
)
{
return
}
// TODO 自定义组件中的 slot 数据采集是在组件内部,导致所在 context 中无法获取到差量数据
// 如何保证每个 vm 数据有变动,就加入 diff 中呢?
// 每次变化,可能触发多次 beforeUpdate,updated
// 子组件 updated 时,可能会增加父组件的 diffData,如 slot 等情况
diff
(
this
.
_$newData
,
this
.
_$data
,
this
.
_$vdUpdatedData
)
this
.
_$data
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
_$newData
))
// setTimeout 一下再 nextTick( 直接 nextTick 的话,会紧接着该 updated 做 flush,导致父组件 updated 数据被丢弃)
...
...
@@ -87,11 +88,7 @@ export function initData (Vue) {
this
.
_$vdomSync
=
new
VDomSync
(
this
.
$options
.
pageId
,
this
.
$options
.
pagePath
,
this
)
}
if
(
this
.
_$vd
)
{
if
(
!
this
.
$parent
)
{
this
.
_$id
=
'
-1
'
}
else
{
this
.
_$id
=
this
.
$parent
.
_$id
+
'
,
'
+
this
.
$vnode
.
data
.
attrs
.
_i
}
this
.
_$id
=
generateId
(
this
,
this
.
$parent
)
this
.
_$vd
.
addVm
(
this
)
this
.
_$vdMountedData
=
Object
.
create
(
null
)
this
.
_$setData
(
MOUNTED_DATA
,
this
.
_$vdMountedData
)
...
...
src/platforms/app-plus/service/framework/plugins/vdom-sync.js
浏览文件 @
95c21b23
...
...
@@ -153,16 +153,12 @@ export class VDomSync {
removeElement
(
elm
)
{
const
elmIndex
=
this
.
elements
.
indexOf
(
elm
)
if
(
elmIndex
===
-
1
)
{
return
console
.
error
(
`removeElement[
${
elm
.
cid
}
][
${
elm
.
nid
}
] not found`
)
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
error
(
`removeElement[
${
elm
.
cid
}
][
${
elm
.
nid
}
] not found`
)
}
this
.
elements
.
splice
(
elmIndex
,
1
)
}
removeElementByCid
(
cid
)
{
if
(
!
cid
)
{
return
}
this
.
elements
=
this
.
elements
.
filter
(
elm
=>
elm
.
cid
!==
cid
)
this
.
elements
.
splice
(
elmIndex
,
1
)
}
push
(
type
,
cid
,
data
,
options
)
{
...
...
src/platforms/app-plus/view/framework/plugins/event.js
浏览文件 @
95c21b23
...
...
@@ -30,9 +30,10 @@ export function initEvent (Vue) {
const
$event
=
this
.
$handleEvent
(
$vueEvent
)
const
cid
=
this
.
_$id
// 当自定义组件根节点触发事件时,nid 始终为 0
const
currentTarget
=
$vueEvent
.
$origCurrentTarget
||
$vueEvent
.
currentTarget
const
nid
=
currentTarget
===
this
.
$el
?
0
:
$event
.
options
.
nid
// 当自定义组件根节点触发事件时,nid 补充前缀,避免与组件内部 nid 冲突(根组件page不需要)
const
nid
=
((
currentTarget
===
this
.
$el
&&
this
.
mpType
!==
'
page
'
)
?
'
r-
'
:
''
)
+
$event
.
options
.
nid
if
(
typeof
nid
===
'
undefined
'
)
{
return
console
.
error
(
`[
${
cid
}
] nid not found`
)
}
...
...
src/platforms/app-plus/view/framework/plugins/vdom-sync.js
浏览文件 @
95c21b23
...
...
@@ -3,11 +3,15 @@ import {
UI_EVENT
}
from
'
../../../constants
'
function
findParentCid
(
vm
)
{
import
{
generateId
}
from
'
../../../helpers/util
'
function
findParent
(
vm
)
{
let
parent
=
vm
.
$parent
while
(
parent
)
{
if
(
parent
.
_$id
)
{
return
parent
.
_$id
return
parent
}
parent
=
parent
.
$parent
}
...
...
@@ -30,11 +34,7 @@ export class VDomSync {
}
initVm
(
vm
)
{
if
(
!
vm
.
$parent
)
{
vm
.
_$id
=
'
-1
'
}
else
{
vm
.
_$id
=
findParentCid
(
vm
)
+
'
,
'
+
vm
.
$vnode
.
data
.
attrs
.
_i
}
vm
.
_$id
=
generateId
(
vm
,
findParent
(
vm
))
let
vData
=
this
.
addBatchVData
[
vm
.
_$id
]
if
(
!
vData
)
{
console
.
error
(
'
cid unmatched
'
,
vm
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录