Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
e22e5b09
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
716
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e22e5b09
编写于
3月 25, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
build:v3
上级
f0c28745
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
1048 addition
and
261 deletion
+1048
-261
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-cli-shared/components/navigation-bar.vue
packages/uni-cli-shared/components/navigation-bar.vue
+1
-1
未找到文件。
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
e22e5b09
...
...
@@ -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
]
=
{
...
...
@@ -2395,11 +2395,11 @@ var serviceContext = (function () {
res
.
errMsg
=
apiName
+
'
:ok
'
;
}
else
if
(
res
.
errMsg
.
indexOf
(
'
:cancel
'
)
!==
-
1
)
{
res
.
errMsg
=
apiName
+
'
:cancel
'
;
}
else
if
(
res
.
errMsg
.
indexOf
(
'
:fail
'
)
!==
-
1
)
{
let
errDetail
=
''
;
let
spaceIndex
=
res
.
errMsg
.
indexOf
(
'
'
);
if
(
spaceIndex
>
-
1
)
{
errDetail
=
res
.
errMsg
.
substr
(
spaceIndex
);
}
else
if
(
res
.
errMsg
.
indexOf
(
'
:fail
'
)
!==
-
1
)
{
let
errDetail
=
''
;
let
spaceIndex
=
res
.
errMsg
.
indexOf
(
'
'
);
if
(
spaceIndex
>
-
1
)
{
errDetail
=
res
.
errMsg
.
substr
(
spaceIndex
);
}
res
.
errMsg
=
apiName
+
'
:fail
'
+
errDetail
;
}
...
...
@@ -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
;
...
...
@@ -5026,8 +4992,8 @@ var serviceContext = (function () {
tabBar
&&
tabBar
.
showTabBar
({
animation
});
}
}
let
maskClickCallback
=
[];
var
tabBar$1
=
{
...
...
@@ -5040,11 +5006,11 @@ var serviceContext = (function () {
tabBar
=
requireNativePlugin
(
'
uni-tabview
'
);
}
catch
(
error
)
{
console
.
log
(
`uni.requireNativePlugin("uni-tabview") error
${
error
}
`
);
}
tabBar
.
onMaskClick
(()
=>
{
maskClickCallback
.
forEach
((
callback
)
=>
{
callback
();
});
}
tabBar
.
onMaskClick
(()
=>
{
maskClickCallback
.
forEach
((
callback
)
=>
{
callback
();
});
});
tabBar
&&
tabBar
.
onClick
(({
index
})
=>
{
clickCallback
(
config
.
list
[
index
],
index
);
...
...
@@ -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
()
{
...
...
@@ -5111,11 +5077,11 @@ var serviceContext = (function () {
color
:
mask
});
},
addEventListener
(
name
,
callback
)
{
addEventListener
(
name
,
callback
)
{
maskClickCallback
.
push
(
callback
);
},
removeEventListener
(
name
,
callback
)
{
let
callbackIndex
=
maskClickCallback
.
indexOf
(
callback
);
removeEventListener
(
name
,
callback
)
{
let
callbackIndex
=
maskClickCallback
.
indexOf
(
callback
);
maskClickCallback
.
splice
(
callbackIndex
,
1
);
}
};
...
...
@@ -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
);
}
removeElementByCid
(
cid
)
{
if
(
!
cid
)
{
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
error
(
`removeElement[
${
elm
.
cid
}
][
${
elm
.
nid
}
] not found`
);
}
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
浏览文件 @
e22e5b09
...
...
@@ -5489,6 +5489,466 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
Vue
.
version
=
'
2.6.11
'
;
var
nextNodeRef
=
1
;
function
uniqueId
()
{
return
(
nextNodeRef
++
).
toString
()
}
var
Node
=
function
Node
()
{
this
.
nodeId
=
uniqueId
();
this
.
ref
=
this
.
nodeId
;
this
.
children
=
[];
this
.
pureChildren
=
[];
this
.
parentNode
=
null
;
this
.
nextSibling
=
null
;
this
.
previousSibling
=
null
;
};
Node
.
prototype
.
destroy
=
function
destroy
()
{
this
.
_$vd
&&
this
.
_$vd
.
removeElement
(
this
);
this
.
children
.
forEach
(
function
(
child
)
{
child
.
destroy
();
});
};
var
Comment
=
/*@__PURE__*/
(
function
(
Node$$1
)
{
function
Comment
(
value
)
{
Node$$1
.
call
(
this
);
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
;
Comment
.
prototype
.
toString
=
function
toString
()
{
return
'
<!--
'
+
this
.
value
+
'
-->
'
};
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
setBody
(
doc
,
el
)
{
el
.
role
=
'
body
'
;
el
.
depth
=
1
;
el
.
ref
=
'
_root
'
;
doc
.
body
=
el
;
}
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
;
}
}
function
previousElement
(
node
)
{
while
(
node
)
{
if
(
node
.
nodeType
===
1
)
{
return
node
}
node
=
node
.
previousSibling
;
}
}
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
}
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
;
Element
.
prototype
.
setAttribute
=
function
setAttribute
(
key
,
value
)
{
if
(
key
===
'
cid
'
)
{
this
.
cid
=
value
;
}
else
if
(
key
===
'
nid
'
)
{
this
.
nid
=
value
;
}
};
Element
.
prototype
.
dispatchEvent
=
function
dispatchEvent
(
name
,
target
)
{
var
handlers
=
this
.
events
[
name
];
if
(
!
handlers
)
{
return
}
handlers
.
forEach
(
function
(
handler
)
{
handler
(
target
);
});
};
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
);
};
Element
.
prototype
.
removeEventListener
=
function
removeEventListener
(
name
,
handler
)
{
var
this
$1
=
this
;
if
(
this
.
cid
===
''
||
this
.
nid
===
''
)
{
return
console
.
error
((
"
cid=
"
+
(
this
.
cid
)
+
"
,nid=
"
+
(
this
.
nid
)
+
"
removeEventListener(
"
+
name
+
"
) not found
"
))
}
var
isRemoved
=
false
;
if
(
this
.
events
[
name
])
{
var
handlerIndex
=
this
.
events
[
name
].
indexOf
(
handler
);
if
(
handlerIndex
!==
-
1
)
{
this
.
events
[
name
].
splice
(
handlerIndex
,
1
);
isRemoved
=
true
;
}
}
if
(
!
isRemoved
)
{
console
.
error
((
"
cid=
"
+
(
this
.
cid
)
+
"
,nid=
"
+
(
this
.
nid
)
+
"
removeEventListener(
"
+
name
+
"
) handler not found
"
));
}
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
...
...
@@ -5539,109 +5999,44 @@ function isUnknownElement () {
/* */
var
noop$1
=
{};
var
UniElement
=
function
UniElement
(
tagName
)
{
this
.
tagName
=
tagName
;
this
.
cid
=
''
;
this
.
nid
=
''
;
this
.
events
=
Object
.
create
(
null
);
};
UniElement
.
prototype
.
setAttribute
=
function
setAttribute
(
key
,
value
)
{
if
(
key
===
'
cid
'
)
{
this
.
cid
=
value
;
}
else
if
(
key
===
'
nid
'
)
{
this
.
nid
=
value
;
}
};
UniElement
.
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
"
));
}
handlers
.
forEach
(
function
(
handler
)
{
handler
(
target
);
});
};
UniElement
.
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
);
};
UniElement
.
prototype
.
removeEventListener
=
function
removeEventListener
(
name
,
handler
)
{
var
this
$1
=
this
;
if
(
this
.
cid
===
''
||
this
.
nid
===
''
)
{
return
console
.
error
((
"
cid=
"
+
(
this
.
cid
)
+
"
,nid=
"
+
(
this
.
nid
)
+
"
removeEventListener(
"
+
name
+
"
) not found
"
))
}
var
isRemoved
=
false
;
if
(
this
.
events
[
name
])
{
var
handlerIndex
=
this
.
events
[
name
].
indexOf
(
handler
);
if
(
handlerIndex
!==
-
1
)
{
this
.
events
[
name
].
splice
(
handlerIndex
,
1
);
isRemoved
=
true
;
}
}
if
(
!
isRemoved
)
{
console
.
error
((
"
cid=
"
+
(
this
.
cid
)
+
"
,nid=
"
+
(
this
.
nid
)
+
"
removeEventListener(
"
+
name
+
"
) handler not found
"
));
}
Object
.
keys
(
this
.
events
).
every
(
function
(
eventType
)
{
return
this
$1
.
events
[
eventType
].
length
===
0
;
})
&&
this
.
_$vd
.
removeElement
(
this
);
};
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
()
{}
...
...
@@ -6793,12 +7188,21 @@ function updateDOMListeners (oldVnode, vnode) {
var
on
=
vnode
.
data
.
on
||
{};
var
oldOn
=
oldVnode
.
data
.
on
||
{};
target$1
=
vnode
.
elm
;
// fixed by xxxxxx 存储 vd
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
浏览文件 @
e22e5b09
...
...
@@ -4745,6 +4745,466 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
Vue
.
version
=
'
2.6.11
'
;
var
nextNodeRef
=
1
;
function
uniqueId
()
{
return
(
nextNodeRef
++
).
toString
()
}
var
Node
=
function
Node
()
{
this
.
nodeId
=
uniqueId
();
this
.
ref
=
this
.
nodeId
;
this
.
children
=
[];
this
.
pureChildren
=
[];
this
.
parentNode
=
null
;
this
.
nextSibling
=
null
;
this
.
previousSibling
=
null
;
};
Node
.
prototype
.
destroy
=
function
destroy
()
{
this
.
_$vd
&&
this
.
_$vd
.
removeElement
(
this
);
this
.
children
.
forEach
(
function
(
child
)
{
child
.
destroy
();
});
};
var
Comment
=
/*@__PURE__*/
(
function
(
Node$$1
)
{
function
Comment
(
value
)
{
Node$$1
.
call
(
this
);
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
;
Comment
.
prototype
.
toString
=
function
toString
()
{
return
'
<!--
'
+
this
.
value
+
'
-->
'
};
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
setBody
(
doc
,
el
)
{
el
.
role
=
'
body
'
;
el
.
depth
=
1
;
el
.
ref
=
'
_root
'
;
doc
.
body
=
el
;
}
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
;
}
}
function
previousElement
(
node
)
{
while
(
node
)
{
if
(
node
.
nodeType
===
1
)
{
return
node
}
node
=
node
.
previousSibling
;
}
}
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
}
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
;
Element
.
prototype
.
setAttribute
=
function
setAttribute
(
key
,
value
)
{
if
(
key
===
'
cid
'
)
{
this
.
cid
=
value
;
}
else
if
(
key
===
'
nid
'
)
{
this
.
nid
=
value
;
}
};
Element
.
prototype
.
dispatchEvent
=
function
dispatchEvent
(
name
,
target
)
{
var
handlers
=
this
.
events
[
name
];
if
(
!
handlers
)
{
return
}
handlers
.
forEach
(
function
(
handler
)
{
handler
(
target
);
});
};
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
);
};
Element
.
prototype
.
removeEventListener
=
function
removeEventListener
(
name
,
handler
)
{
var
this
$1
=
this
;
if
(
this
.
cid
===
''
||
this
.
nid
===
''
)
{
return
console
.
error
((
"
cid=
"
+
(
this
.
cid
)
+
"
,nid=
"
+
(
this
.
nid
)
+
"
removeEventListener(
"
+
name
+
"
) not found
"
))
}
var
isRemoved
=
false
;
if
(
this
.
events
[
name
])
{
var
handlerIndex
=
this
.
events
[
name
].
indexOf
(
handler
);
if
(
handlerIndex
!==
-
1
)
{
this
.
events
[
name
].
splice
(
handlerIndex
,
1
);
isRemoved
=
true
;
}
}
if
(
!
isRemoved
)
{
console
.
error
((
"
cid=
"
+
(
this
.
cid
)
+
"
,nid=
"
+
(
this
.
nid
)
+
"
removeEventListener(
"
+
name
+
"
) handler not found
"
));
}
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
...
...
@@ -4795,109 +5255,44 @@ function isUnknownElement () {
/* */
var
noop$1
=
{};
var
UniElement
=
function
UniElement
(
tagName
)
{
this
.
tagName
=
tagName
;
this
.
cid
=
''
;
this
.
nid
=
''
;
this
.
events
=
Object
.
create
(
null
);
};
UniElement
.
prototype
.
setAttribute
=
function
setAttribute
(
key
,
value
)
{
if
(
key
===
'
cid
'
)
{
this
.
cid
=
value
;
}
else
if
(
key
===
'
nid
'
)
{
this
.
nid
=
value
;
}
};
UniElement
.
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
"
));
}
handlers
.
forEach
(
function
(
handler
)
{
handler
(
target
);
});
};
UniElement
.
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
);
};
UniElement
.
prototype
.
removeEventListener
=
function
removeEventListener
(
name
,
handler
)
{
var
this
$1
=
this
;
if
(
this
.
cid
===
''
||
this
.
nid
===
''
)
{
return
console
.
error
((
"
cid=
"
+
(
this
.
cid
)
+
"
,nid=
"
+
(
this
.
nid
)
+
"
removeEventListener(
"
+
name
+
"
) not found
"
))
}
var
isRemoved
=
false
;
if
(
this
.
events
[
name
])
{
var
handlerIndex
=
this
.
events
[
name
].
indexOf
(
handler
);
if
(
handlerIndex
!==
-
1
)
{
this
.
events
[
name
].
splice
(
handlerIndex
,
1
);
isRemoved
=
true
;
}
}
if
(
!
isRemoved
)
{
console
.
error
((
"
cid=
"
+
(
this
.
cid
)
+
"
,nid=
"
+
(
this
.
nid
)
+
"
removeEventListener(
"
+
name
+
"
) handler not found
"
));
}
Object
.
keys
(
this
.
events
).
every
(
function
(
eventType
)
{
return
this
$1
.
events
[
eventType
].
length
===
0
;
})
&&
this
.
_$vd
.
removeElement
(
this
);
};
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
()
{}
...
...
@@ -5942,12 +6337,21 @@ function updateDOMListeners (oldVnode, vnode) {
var
on
=
vnode
.
data
.
on
||
{};
var
oldOn
=
oldVnode
.
data
.
on
||
{};
target$1
=
vnode
.
elm
;
// fixed by xxxxxx 存储 vd
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-cli-shared/components/navigation-bar.vue
浏览文件 @
e22e5b09
...
...
@@ -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
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录