Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
5d4ab082
U
uni-app
项目概览
DCloud
/
uni-app
4 个月 前同步成功
通知
726
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,发现更多精彩内容 >>
提交
5d4ab082
编写于
3月 18, 2020
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' into alpha
# Conflicts: # packages/uni-h5/dist/index.umd.min.js
上级
16905b69
ffcfcfb4
变更
19
展开全部
隐藏空白更改
内联
并排
Showing
19 changed file
with
275 addition
and
105 deletion
+275
-105
docs/api/ui/prompt.md
docs/api/ui/prompt.md
+14
-4
lib/apis.js
lib/apis.js
+3
-1
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+126
-64
packages/uni-app-plus/dist/service.runtime.esm.dev.js
packages/uni-app-plus/dist/service.runtime.esm.dev.js
+8
-2
packages/uni-app-plus/dist/service.runtime.esm.prod.js
packages/uni-app-plus/dist/service.runtime.esm.prod.js
+8
-2
packages/uni-h5/dist/index.umd.min.js
packages/uni-h5/dist/index.umd.min.js
+1
-1
src/core/helpers/promise.js
src/core/helpers/promise.js
+1
-1
src/core/helpers/protocol/ui/popup.js
src/core/helpers/protocol/ui/popup.js
+4
-1
src/platforms/app-plus/service/api/index.js
src/platforms/app-plus/service/api/index.js
+2
-0
src/platforms/app-plus/service/api/plugin/on-native-event-receive.js
...ms/app-plus/service/api/plugin/on-native-event-receive.js
+16
-0
src/platforms/app-plus/service/api/plugin/send-native-event.js
...latforms/app-plus/service/api/plugin/send-native-event.js
+4
-0
src/platforms/app-plus/service/api/plugin/sub-nvue.js
src/platforms/app-plus/service/api/plugin/sub-nvue.js
+14
-3
src/platforms/app-plus/service/api/route/switch-tab.js
src/platforms/app-plus/service/api/route/switch-tab.js
+12
-5
src/platforms/app-plus/service/api/ui/popup.js
src/platforms/app-plus/service/api/ui/popup.js
+5
-4
src/platforms/app-plus/service/framework/app.js
src/platforms/app-plus/service/framework/app.js
+20
-9
src/platforms/app-plus/service/framework/plugins/vdom-sync.js
...platforms/app-plus/service/framework/plugins/vdom-sync.js
+7
-0
src/platforms/app-plus/service/framework/webview/parser/sub-nvue-parser.js
...-plus/service/framework/webview/parser/sub-nvue-parser.js
+1
-0
src/platforms/app-plus/service/framework/webview/parser/title-nview-parser.js
...us/service/framework/webview/parser/title-nview-parser.js
+4
-1
src/platforms/h5/components/page/index.vue
src/platforms/h5/components/page/index.vue
+25
-7
未找到文件。
docs/api/ui/prompt.md
浏览文件 @
5d4ab082
...
...
@@ -112,10 +112,10 @@ setTimeout(function () {
|success|Function|否|接口调用成功的回调函数||
|fail|Function|否|接口调用失败的回调函数||
|complete|Function|否|接口调用结束的回调函数(调用成功、失败都会执行)|
|
**注意**
-
钉钉小程序真机与模拟器表现有差异,真机title,content均为必填项
**注意**
-
钉钉小程序真机与模拟器表现有差异,真机title,content均为必填项
**success返回参数说明**
...
...
@@ -154,10 +154,20 @@ uni.showModal({
|:-|:-|:-|:-|:-|
|itemList|Array
<
String
>
|是|按钮的文字数组|微信、百度、头条小程序数组长度最大为6个|
|itemColor|HexColor|否|按钮的文字颜色,字符串格式,默认为"#000000"|头条小程序不支持|
|popover|Object|否|iPad 上弹出原生选择按钮框的指示区域,默认指向屏幕底部水平居中位置|仅 App 2.6.6+ 支持|
|success|Function|否|接口调用成功的回调函数,详见返回参数说明||
|fail|Function|否|接口调用失败的回调函数||
|complete|Function|否|接口调用结束的回调函数(调用成功、失败都会执行)|
|
**popover 值说明(仅App生效)**
|值|类型|说明|
|:-|:-|:-|
|top|Number|指示区域坐标|
|left|Number|指示区域坐标|
|width|Number|指示区域宽度|
|height|Number|指示区域高度|
**success返回参数说明**
|参数|类型|说明|
...
...
lib/apis.js
浏览文件 @
5d4ab082
...
...
@@ -201,7 +201,9 @@ const third = [
'
restoreGlobal
'
,
'
getSubNVueById
'
,
'
getCurrentSubNVue
'
,
'
setPageMeta
'
'
setPageMeta
'
,
'
onNativeEventReceive
'
,
'
sendNativeEvent
'
]
const
ad
=
[
...
...
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
5d4ab082
...
...
@@ -212,7 +212,9 @@ var serviceContext = (function () {
'
restoreGlobal
'
,
'
getSubNVueById
'
,
'
getCurrentSubNVue
'
,
'
setPageMeta
'
'
setPageMeta
'
,
'
onNativeEventReceive
'
,
'
sendNativeEvent
'
];
const
ad
=
[
...
...
@@ -639,7 +641,7 @@ var serviceContext = (function () {
};
const
SYNC_API_RE
=
/^
\$
|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
/^
\$
|
sendNativeEvent|
restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
...
...
@@ -1948,6 +1950,9 @@ var serviceContext = (function () {
visible
:
{
type
:
Boolean
,
default
:
true
},
popover
:
{
type
:
Object
}
};
...
...
@@ -7314,13 +7319,41 @@ var serviceContext = (function () {
if
(
webview
&&
!
webview
.
$processed
)
{
wrapper$1
(
webview
);
}
let
oldSetStyle
=
webview
.
setStyle
;
var
parentWebview
=
plus
.
webview
.
getWebviewById
(
webview
.
__uniapp_mask_id
);
webview
.
setStyle
=
function
(
style
)
{
if
(
style
&&
style
.
mask
)
{
parentWebview
.
setStyle
({
mask
:
style
.
mask
});
delete
style
.
mask
;
}
oldSetStyle
.
call
(
this
,
style
);
};
return
webview
}
}
function
getCurrentSubNVue
()
{
return
getSubNVueById
(
plus
.
webview
.
currentWebview
().
id
)
}
const
callbacks$3
=
[];
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
sendNativeEvent
(
event
,
data
,
callback
)
{
// 实时获取weex module(weex可能会变化,比如首页nvue加速显示时)
return
weex
.
requireModule
(
'
plus
'
).
sendNativeEvent
(
event
,
data
,
callback
)
}
let
firstBackTime
=
0
;
function
quit
()
{
...
...
@@ -7466,6 +7499,9 @@ var serviceContext = (function () {
(
windowOptions
.
navigationStyle
===
'
custom
'
&&
!
isPlainObject
(
titleNView
)
)
||
(
windowOptions
.
transparentTitle
===
'
always
'
&&
!
isPlainObject
(
titleNView
)
)
)
{
return
false
...
...
@@ -7484,7 +7520,7 @@ var serviceContext = (function () {
titleText
:
titleImage
===
''
?
windowOptions
.
navigationBarTitleText
||
''
:
''
,
titleColor
:
windowOptions
.
navigationBarTextStyle
===
'
black
'
?
'
#000000
'
:
'
#ffffff
'
,
type
:
titleNViewTypeList
[
transparentTitle
],
backgroundColor
:
transparentTitle
!==
'
always
'
?
windowOptions
.
navigationBarBackgroundColor
||
'
#000000
'
:
'
rgba(0,0,0,0)
'
,
backgroundColor
:
windowOptions
.
navigationBarBackgroundColor
||
'
#f8f8f8
'
,
tags
:
titleImage
===
''
?
[]
:
[{
'
tag
'
:
'
img
'
,
'
src
'
:
titleImage
,
...
...
@@ -7754,6 +7790,7 @@ var serviceContext = (function () {
`UNIAPP[webview][
${
webview
.
id
}
]:create[
${
subNVue
.
id
}
]:
${
JSON
.
stringify
(
style
)}
`
);
}
delete
style
.
mask
;
const
subNVueWebview
=
plus
.
webview
.
create
(
''
,
subNVue
.
id
,
style
,
extras
);
if
(
isPopup
)
{
...
...
@@ -8408,10 +8445,12 @@ var serviceContext = (function () {
const
pages
=
getCurrentPages
();
const
len
=
pages
.
length
;
let
callOnHide
=
false
;
let
callOnShow
=
false
;
let
currentPage
;
if
(
len
>=
1
)
{
// 前一个页面是非 tabBar 页面
c
onst
c
urrentPage
=
pages
[
len
-
1
];
currentPage
=
pages
[
len
-
1
];
if
(
!
currentPage
.
$page
.
meta
.
isTabBar
)
{
// 前一个页面为非 tabBar 页面时,目标tabBar需要强制触发onShow
// 该情况下目标页tabBarPage的visible是不对的
...
...
@@ -8434,8 +8473,7 @@ var serviceContext = (function () {
}
},
100
);
}
else
{
// 前一个 tabBar 触发 onHide
currentPage
.
$vm
.
__call_hook
(
'
onHide
'
);
callOnHide
=
true
;
}
}
...
...
@@ -8454,7 +8492,13 @@ var serviceContext = (function () {
}
}
});
// 相同tabBar页面
if
(
currentPage
===
tabBarPage
)
{
callOnHide
=
false
;
}
if
(
currentPage
&&
callOnHide
)
{
currentPage
.
$vm
.
__call_hook
(
'
onHide
'
);
}
if
(
tabBarPage
)
{
tabBarPage
.
$getAppWebview
().
show
(
'
none
'
);
// 等visible状态都切换完之后,再触发onShow,否则开发者在onShow里边 getCurrentPages 会不准确
...
...
@@ -8919,11 +8963,12 @@ var serviceContext = (function () {
function
showActionSheet$1
({
itemList
=
[],
itemColor
=
'
#000000
'
,
title
=
''
title
=
''
,
popover
},
callbackId
)
{
const
options
=
{
buttons
:
itemList
.
map
(
item
=>
({
title
:
item
,
title
:
item
,
color
:
itemColor
}))
};
...
...
@@ -8935,7 +8980,7 @@ var serviceContext = (function () {
options
.
cancel
=
'
取消
'
;
}
plus
.
nativeUI
.
actionSheet
(
options
,
(
e
)
=>
{
plus
.
nativeUI
.
actionSheet
(
Object
.
assign
(
options
,
{
popover
})
,
(
e
)
=>
{
if
(
e
.
index
>
0
)
{
invoke$1
(
callbackId
,
{
errMsg
:
'
showActionSheet:ok
'
,
...
...
@@ -9084,16 +9129,16 @@ var serviceContext = (function () {
}
}
const
callbacks$
3
=
{};
const
callbacks$
4
=
{};
function
createCallbacks
(
namespace
)
{
let
scopedCallbacks
=
callbacks$
3
[
namespace
];
let
scopedCallbacks
=
callbacks$
4
[
namespace
];
if
(
!
scopedCallbacks
)
{
scopedCallbacks
=
{
id
:
1
,
callbacks
:
Object
.
create
(
null
)
};
callbacks$
3
[
namespace
]
=
scopedCallbacks
;
callbacks$
4
[
namespace
]
=
scopedCallbacks
;
}
return
{
get
(
id
)
{
...
...
@@ -9407,6 +9452,9 @@ var serviceContext = (function () {
restoreGlobal
:
restoreGlobal
,
getSubNVueById
:
getSubNVueById
,
getCurrentSubNVue
:
getCurrentSubNVue
,
onNativeEventReceive
:
onNativeEventReceive
,
consumeNativeEvent
:
consumeNativeEvent
,
sendNativeEvent
:
sendNativeEvent
,
navigateBack
:
navigateBack$1
,
navigateTo
:
navigateTo$1
,
reLaunch
:
reLaunch$1
,
...
...
@@ -9672,9 +9720,9 @@ var serviceContext = (function () {
'
error
'
,
'
waiting
'
];
const
callbacks$
4
=
{};
const
callbacks$
5
=
{};
eventNames$2
.
forEach
(
name
=>
{
callbacks$
4
[
name
]
=
[];
callbacks$
5
[
name
]
=
[];
});
const
props$1
=
[
...
...
@@ -9738,7 +9786,7 @@ var serviceContext = (function () {
errMsg
,
errCode
})
=>
{
callbacks$
4
[
state
].
forEach
(
callback
=>
{
callbacks$
5
[
state
].
forEach
(
callback
=>
{
if
(
typeof
callback
===
'
function
'
)
{
callback
(
state
===
'
error
'
?
{
errMsg
,
...
...
@@ -9790,7 +9838,7 @@ var serviceContext = (function () {
eventNames$2
.
forEach
(
item
=>
{
const
name
=
item
[
0
].
toUpperCase
()
+
item
.
substr
(
1
);
BackgroundAudioManager
.
prototype
[
`on
${
name
}
`
]
=
function
(
callback
)
{
callbacks$
4
[
item
].
push
(
callback
);
callbacks$
5
[
item
].
push
(
callback
);
};
});
...
...
@@ -10830,10 +10878,10 @@ var serviceContext = (function () {
EditorContext
:
EditorContext
});
const
callbacks$
5
=
[];
const
callbacks$
6
=
[];
onMethod
(
'
onAccelerometerChange
'
,
function
(
res
)
{
callbacks$
5
.
forEach
(
callbackId
=>
{
callbacks$
6
.
forEach
(
callbackId
=>
{
invoke$1
(
callbackId
,
res
);
});
});
...
...
@@ -10845,7 +10893,7 @@ var serviceContext = (function () {
*/
function
onAccelerometerChange
(
callbackId
)
{
// TODO 当没有 start 时,添加 on 需要主动 start?
callbacks$
5
.
push
(
callbackId
);
callbacks$
6
.
push
(
callbackId
);
if
(
!
isEnable
)
{
startAccelerometer
();
}
...
...
@@ -10902,10 +10950,10 @@ var serviceContext = (function () {
onBLECharacteristicValueChange
:
onBLECharacteristicValueChange$1
});
const
callbacks$
6
=
[];
const
callbacks$
7
=
[];
onMethod
(
'
onCompassChange
'
,
function
(
res
)
{
callbacks$
6
.
forEach
(
callbackId
=>
{
callbacks$
7
.
forEach
(
callbackId
=>
{
invoke$1
(
callbackId
,
res
);
});
});
...
...
@@ -10917,7 +10965,7 @@ var serviceContext = (function () {
*/
function
onCompassChange
(
callbackId
)
{
// TODO 当没有 start 时,添加 on 需要主动 start?
callbacks$
6
.
push
(
callbackId
);
callbacks$
7
.
push
(
callbackId
);
if
(
!
isEnable$1
)
{
startCompass
();
}
...
...
@@ -10949,16 +10997,16 @@ var serviceContext = (function () {
stopCompass
:
stopCompass
});
const
callbacks$
7
=
[];
const
callbacks$
8
=
[];
onMethod
(
'
onNetworkStatusChange
'
,
res
=>
{
callbacks$
7
.
forEach
(
callbackId
=>
{
callbacks$
8
.
forEach
(
callbackId
=>
{
invoke$1
(
callbackId
,
res
);
});
});
function
onNetworkStatusChange
(
callbackId
)
{
callbacks$
7
.
push
(
callbackId
);
callbacks$
8
.
push
(
callbackId
);
}
var
require_context_module_1_13
=
/*#__PURE__*/
Object
.
freeze
({
...
...
@@ -10966,16 +11014,16 @@ var serviceContext = (function () {
onNetworkStatusChange
:
onNetworkStatusChange
});
const
callbacks$
8
=
[];
const
callbacks$
9
=
[];
onMethod
(
'
onUIStyleChange
'
,
function
(
res
)
{
callbacks$
8
.
forEach
(
callbackId
=>
{
callbacks$
9
.
forEach
(
callbackId
=>
{
invoke$1
(
callbackId
,
res
);
});
});
function
onUIStyleChange
(
callbackId
)
{
callbacks$
8
.
push
(
callbackId
);
callbacks$
9
.
push
(
callbackId
);
}
var
require_context_module_1_14
=
/*#__PURE__*/
Object
.
freeze
({
...
...
@@ -11011,7 +11059,7 @@ var serviceContext = (function () {
previewImage
:
previewImage$1
});
const
callbacks$
9
=
{
const
callbacks$
a
=
{
pause
:
[],
resume
:
[],
start
:
[],
...
...
@@ -11025,7 +11073,7 @@ var serviceContext = (function () {
const
state
=
res
.
state
;
delete
res
.
state
;
delete
res
.
errMsg
;
callbacks$
9
[
state
].
forEach
(
callback
=>
{
callbacks$
a
[
state
].
forEach
(
callback
=>
{
if
(
typeof
callback
===
'
function
'
)
{
callback
(
res
);
}
...
...
@@ -11033,7 +11081,7 @@ var serviceContext = (function () {
});
}
onError
(
callback
)
{
callbacks$
9
.
error
.
push
(
callback
);
callbacks$
a
.
error
.
push
(
callback
);
}
onFrameRecorded
(
callback
)
{
...
...
@@ -11045,16 +11093,16 @@ var serviceContext = (function () {
}
onPause
(
callback
)
{
callbacks$
9
.
pause
.
push
(
callback
);
callbacks$
a
.
pause
.
push
(
callback
);
}
onResume
(
callback
)
{
callbacks$
9
.
resume
.
push
(
callback
);
callbacks$
a
.
resume
.
push
(
callback
);
}
onStart
(
callback
)
{
callbacks$
9
.
start
.
push
(
callback
);
callbacks$
a
.
start
.
push
(
callback
);
}
onStop
(
callback
)
{
callbacks$
9
.
stop
.
push
(
callback
);
callbacks$
a
.
stop
.
push
(
callback
);
}
pause
()
{
invokeMethod
(
'
operateRecorder
'
,
{
...
...
@@ -11368,7 +11416,7 @@ var serviceContext = (function () {
const
socketTasks$1
=
Object
.
create
(
null
);
const
socketTasksArray
=
[];
const
callbacks$
a
=
Object
.
create
(
null
);
const
callbacks$
b
=
Object
.
create
(
null
);
onMethod
(
'
onSocketTaskStateChange
'
,
({
socketTaskId
,
state
,
...
...
@@ -11382,8 +11430,8 @@ var serviceContext = (function () {
if
(
state
===
'
open
'
)
{
socketTask
.
readyState
=
socketTask
.
OPEN
;
}
if
(
socketTask
===
socketTasksArray
[
0
]
&&
callbacks$
a
[
state
])
{
invoke$1
(
callbacks$
a
[
state
],
state
===
'
message
'
?
{
if
(
socketTask
===
socketTasksArray
[
0
]
&&
callbacks$
b
[
state
])
{
invoke$1
(
callbacks$
b
[
state
],
state
===
'
message
'
?
{
data
}
:
{});
}
...
...
@@ -11449,19 +11497,19 @@ var serviceContext = (function () {
}
function
onSocketOpen
(
callbackId
)
{
callbacks$
a
.
open
=
callbackId
;
callbacks$
b
.
open
=
callbackId
;
}
function
onSocketError
(
callbackId
)
{
callbacks$
a
.
error
=
callbackId
;
callbacks$
b
.
error
=
callbackId
;
}
function
onSocketMessage
(
callbackId
)
{
callbacks$
a
.
message
=
callbackId
;
callbacks$
b
.
message
=
callbackId
;
}
function
onSocketClose
(
callbackId
)
{
callbacks$
a
.
close
=
callbackId
;
callbacks$
b
.
close
=
callbackId
;
}
var
require_context_module_1_19
=
/*#__PURE__*/
Object
.
freeze
({
...
...
@@ -11853,16 +11901,16 @@ var serviceContext = (function () {
createSelectorQuery
:
createSelectorQuery
});
const
callbacks$
b
=
[];
const
callbacks$
c
=
[];
onMethod
(
'
onKeyboardHeightChange
'
,
res
=>
{
callbacks$
b
.
forEach
(
callbackId
=>
{
callbacks$
c
.
forEach
(
callbackId
=>
{
invoke$1
(
callbackId
,
res
);
});
});
function
onKeyboardHeightChange
(
callbackId
)
{
callbacks$
b
.
push
(
callbackId
);
callbacks$
c
.
push
(
callbackId
);
}
var
require_context_module_1_24
=
/*#__PURE__*/
Object
.
freeze
({
...
...
@@ -11941,16 +11989,16 @@ var serviceContext = (function () {
const
hideTabBarRedDot$1
=
removeTabBarBadge$1
;
const
callbacks$
c
=
[];
const
callbacks$
d
=
[];
onMethod
(
'
onTabBarMidButtonTap
'
,
res
=>
{
callbacks$
c
.
forEach
(
callbackId
=>
{
callbacks$
d
.
forEach
(
callbackId
=>
{
invoke$1
(
callbackId
,
res
);
});
});
function
onTabBarMidButtonTap
(
callbackId
)
{
callbacks$
c
.
push
(
callbackId
);
callbacks$
d
.
push
(
callbackId
);
}
var
require_context_module_1_28
=
/*#__PURE__*/
Object
.
freeze
({
...
...
@@ -11961,22 +12009,22 @@ var serviceContext = (function () {
onTabBarMidButtonTap
:
onTabBarMidButtonTap
});
const
callbacks$
d
=
[];
const
callbacks$
e
=
[];
onMethod
(
'
onViewDidResize
'
,
res
=>
{
callbacks$
d
.
forEach
(
callbackId
=>
{
callbacks$
e
.
forEach
(
callbackId
=>
{
invoke$1
(
callbackId
,
res
);
});
});
function
onWindowResize
(
callbackId
)
{
callbacks$
d
.
push
(
callbackId
);
callbacks$
e
.
push
(
callbackId
);
}
function
offWindowResize
(
callbackId
)
{
// TODO 目前 on 和 off 即使传入同一个 function,获取到的 callbackId 也不会一致,导致不能 off 掉指定
// 后续修复
// 此处和微信平台一致查询不到去掉最后一个
callbacks$
d
.
splice
(
callbacks$d
.
indexOf
(
callbackId
),
1
);
callbacks$
e
.
splice
(
callbacks$e
.
indexOf
(
callbackId
),
1
);
}
var
require_context_module_1_29
=
/*#__PURE__*/
Object
.
freeze
({
...
...
@@ -12450,7 +12498,7 @@ var serviceContext = (function () {
);
}
function
initGlobalListeners
()
{
function
initGlobalListeners
()
{
const
globalEvent
=
requireNativePlugin
(
'
globalEvent
'
);
const
emit
=
UniServiceJSBridge
.
emit
;
...
...
@@ -12479,13 +12527,20 @@ var serviceContext = (function () {
publish
(
'
onKeyboardHeightChange
'
,
{
height
:
event
.
height
});
});
globalEvent
.
addEventListener
(
'
uistylechange
'
,
function
(
event
)
{
publish
(
'
onUIStyleChange
'
,
{
style
:
event
.
uistyle
});
});
});
globalEvent
.
addEventListener
(
'
uistylechange
'
,
function
(
event
)
{
publish
(
'
onUIStyleChange
'
,
{
style
:
event
.
uistyle
});
});
globalEvent
.
addEventListener
(
'
uniMPNativeEvent
'
,
function
({
event
,
data
})
{
consumeNativeEvent
(
event
,
data
);
});
plus
.
globalEvent
.
addEventListener
(
'
plusMessage
'
,
onPlusMessage$1
);
...
...
@@ -12989,6 +13044,13 @@ var serviceContext = (function () {
this
.
elements
.
splice
(
elmIndex
,
1
);
}
removeElementByCid
(
cid
)
{
if
(
!
cid
)
{
return
}
this
.
elements
=
this
.
elements
.
filter
(
elm
=>
elm
.
cid
!==
cid
);
}
push
(
type
,
cid
,
data
,
options
)
{
const
typeData
=
[
cid
,
data
];
if
(
options
)
{
...
...
packages/uni-app-plus/dist/service.runtime.esm.dev.js
浏览文件 @
5d4ab082
...
...
@@ -5618,9 +5618,14 @@ function insertBefore() {
}
function
removeChild
(
node
,
child
)
{
if
(
child
&&
child
.
_$vd
)
{
child
.
_$vd
.
removeElement
(
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
);
}
function
appendChild
()
{
...
...
@@ -6084,6 +6089,7 @@ function createPatchFunction (backend) {
if
(
isDef
(
i
=
vnode
.
componentInstance
)
&&
isDef
(
i
=
i
.
_vnode
)
&&
isDef
(
i
.
data
))
{
removeAndInvokeRemoveHook
(
i
,
rm
);
}
else
if
(
isDef
(
children
=
vnode
.
children
))
{
// fixed by xxxxxx
// app-plus service 层 elm 暂未实现父子关系维护,移除父 elm 时,导致子 elm 还存留(影响了事件查找)
// 暂时使用 vnode 的 children 递归 rm 掉子 elm
for
(
i
=
0
;
i
<
children
.
length
;
i
++
)
{
...
...
packages/uni-app-plus/dist/service.runtime.esm.prod.js
浏览文件 @
5d4ab082
...
...
@@ -4874,9 +4874,14 @@ function insertBefore() {
}
function
removeChild
(
node
,
child
)
{
if
(
child
&&
child
.
_$vd
)
{
child
.
_$vd
.
removeElement
(
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
);
}
function
appendChild
()
{
...
...
@@ -5302,6 +5307,7 @@ function createPatchFunction (backend) {
if
(
isDef
(
i
=
vnode
.
componentInstance
)
&&
isDef
(
i
=
i
.
_vnode
)
&&
isDef
(
i
.
data
))
{
removeAndInvokeRemoveHook
(
i
,
rm
);
}
else
if
(
isDef
(
children
=
vnode
.
children
))
{
// fixed by xxxxxx
// app-plus service 层 elm 暂未实现父子关系维护,移除父 elm 时,导致子 elm 还存留(影响了事件查找)
// 暂时使用 vnode 的 children 递归 rm 掉子 elm
for
(
i
=
0
;
i
<
children
.
length
;
i
++
)
{
...
...
packages/uni-h5/dist/index.umd.min.js
浏览文件 @
5d4ab082
此差异已折叠。
点击以展开。
src/core/helpers/promise.js
浏览文件 @
5d4ab082
...
...
@@ -8,7 +8,7 @@ import {
}
from
'
./interceptor
'
const
SYNC_API_RE
=
/^
\$
|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
/^
\$
|
sendNativeEvent|
restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
const
CONTEXT_API_RE
=
/^create|Manager$/
...
...
src/core/helpers/protocol/ui/popup.js
浏览文件 @
5d4ab082
...
...
@@ -110,5 +110,8 @@ export const showActionSheet = {
visible
:
{
type
:
Boolean
,
default
:
true
},
popover
:
{
type
:
Object
}
}
}
src/platforms/app-plus/service/api/index.js
浏览文件 @
5d4ab082
...
...
@@ -50,6 +50,8 @@ export * from './plugin/require-native-plugin'
export
*
from
'
./plugin/share
'
export
*
from
'
./plugin/restore-global
'
export
*
from
'
./plugin/sub-nvue
'
export
*
from
'
./plugin/on-native-event-receive
'
export
*
from
'
./plugin/send-native-event
'
export
*
from
'
./route/navigate-back
'
export
*
from
'
./route/navigate-to
'
...
...
src/platforms/app-plus/service/api/plugin/on-native-event-receive.js
0 → 100644
浏览文件 @
5d4ab082
import
{
isFn
}
from
'
uni-shared
'
const
callbacks
=
[]
export
function
onNativeEventReceive
(
callback
)
{
isFn
(
callback
)
&&
callbacks
.
indexOf
(
callback
)
===
-
1
&&
callbacks
.
push
(
callback
)
}
export
function
consumeNativeEvent
(
event
,
data
)
{
callbacks
.
forEach
(
callback
=>
callback
(
event
,
data
))
}
src/platforms/app-plus/service/api/plugin/send-native-event.js
0 → 100644
浏览文件 @
5d4ab082
export
function
sendNativeEvent
(
event
,
data
,
callback
)
{
// 实时获取weex module(weex可能会变化,比如首页nvue加速显示时)
return
weex
.
requireModule
(
'
plus
'
).
sendNativeEvent
(
event
,
data
,
callback
)
}
src/platforms/app-plus/service/api/plugin/sub-nvue.js
浏览文件 @
5d4ab082
import
{
requireNativePlugin
}
from
'
./require-native-plugin
'
function
wrapper
(
webview
)
{
webview
.
$processed
=
true
...
...
@@ -66,9 +66,20 @@ export function getSubNVueById (id) {
if
(
webview
&&
!
webview
.
$processed
)
{
wrapper
(
webview
)
}
let
oldSetStyle
=
webview
.
setStyle
var
parentWebview
=
plus
.
webview
.
getWebviewById
(
webview
.
__uniapp_mask_id
)
webview
.
setStyle
=
function
(
style
)
{
if
(
style
&&
style
.
mask
)
{
parentWebview
.
setStyle
({
mask
:
style
.
mask
})
delete
style
.
mask
}
oldSetStyle
.
call
(
this
,
style
)
}
return
webview
}
}
export
function
getCurrentSubNVue
()
{
return
getSubNVueById
(
plus
.
webview
.
currentWebview
().
id
)
}
src/platforms/app-plus/service/api/route/switch-tab.js
浏览文件 @
5d4ab082
...
...
@@ -32,10 +32,12 @@ function _switchTab ({
const
pages
=
getCurrentPages
()
const
len
=
pages
.
length
let
callOnHide
=
false
let
callOnShow
=
false
let
currentPage
if
(
len
>=
1
)
{
// 前一个页面是非 tabBar 页面
c
onst
c
urrentPage
=
pages
[
len
-
1
]
currentPage
=
pages
[
len
-
1
]
if
(
!
currentPage
.
$page
.
meta
.
isTabBar
)
{
// 前一个页面为非 tabBar 页面时,目标tabBar需要强制触发onShow
// 该情况下目标页tabBarPage的visible是不对的
...
...
@@ -58,8 +60,7 @@ function _switchTab ({
}
},
100
)
}
else
{
// 前一个 tabBar 触发 onHide
currentPage
.
$vm
.
__call_hook
(
'
onHide
'
)
callOnHide
=
true
}
}
...
...
@@ -78,7 +79,13 @@ function _switchTab ({
}
}
})
// 相同tabBar页面
if
(
currentPage
===
tabBarPage
)
{
callOnHide
=
false
}
if
(
currentPage
&&
callOnHide
)
{
currentPage
.
$vm
.
__call_hook
(
'
onHide
'
)
}
if
(
tabBarPage
)
{
tabBarPage
.
$getAppWebview
().
show
(
'
none
'
)
// 等visible状态都切换完之后,再触发onShow,否则开发者在onShow里边 getCurrentPages 会不准确
...
...
src/platforms/app-plus/service/api/ui/popup.js
浏览文件 @
5d4ab082
...
...
@@ -154,11 +154,12 @@ export function showModal ({
export
function
showActionSheet
({
itemList
=
[],
itemColor
=
'
#000000
'
,
title
=
''
title
=
''
,
popover
},
callbackId
)
{
const
options
=
{
buttons
:
itemList
.
map
(
item
=>
({
title
:
item
,
title
:
item
,
color
:
itemColor
}))
}
...
...
@@ -170,7 +171,7 @@ export function showActionSheet ({
options
.
cancel
=
'
取消
'
}
plus
.
nativeUI
.
actionSheet
(
options
,
(
e
)
=>
{
plus
.
nativeUI
.
actionSheet
(
Object
.
assign
(
options
,
{
popover
})
,
(
e
)
=>
{
if
(
e
.
index
>
0
)
{
invoke
(
callbackId
,
{
errMsg
:
'
showActionSheet:ok
'
,
...
...
@@ -182,4 +183,4 @@ export function showActionSheet ({
})
}
})
}
}
src/platforms/app-plus/service/framework/app.js
浏览文件 @
5d4ab082
...
...
@@ -2,7 +2,7 @@ import {
callAppHook
}
from
'
uni-core/service/plugins/util
'
import
initOn
from
'
uni-core/service/bridge/on
'
import
initOn
from
'
uni-core/service/bridge/on
'
import
{
NETWORK_TYPES
...
...
@@ -35,6 +35,10 @@ import {
backbuttonListener
}
from
'
./backbutton
'
import
{
consumeNativeEvent
}
from
'
../api/plugin/on-native-event-receive
'
let
appCtx
const
defaultApp
=
{
...
...
@@ -55,7 +59,7 @@ export function getApp ({
)
}
function
initGlobalListeners
()
{
function
initGlobalListeners
()
{
const
globalEvent
=
requireNativePlugin
(
'
globalEvent
'
)
const
emit
=
UniServiceJSBridge
.
emit
...
...
@@ -84,13 +88,20 @@ function initGlobalListeners () {
publish
(
'
onKeyboardHeightChange
'
,
{
height
:
event
.
height
})
})
globalEvent
.
addEventListener
(
'
uistylechange
'
,
function
(
event
)
{
publish
(
'
onUIStyleChange
'
,
{
style
:
event
.
uistyle
})
})
})
globalEvent
.
addEventListener
(
'
uistylechange
'
,
function
(
event
)
{
publish
(
'
onUIStyleChange
'
,
{
style
:
event
.
uistyle
})
})
globalEvent
.
addEventListener
(
'
uniMPNativeEvent
'
,
function
({
event
,
data
})
{
consumeNativeEvent
(
event
,
data
)
})
plus
.
globalEvent
.
addEventListener
(
'
plusMessage
'
,
onPlusMessage
)
...
...
src/platforms/app-plus/service/framework/plugins/vdom-sync.js
浏览文件 @
5d4ab082
...
...
@@ -158,6 +158,13 @@ export class VDomSync {
this
.
elements
.
splice
(
elmIndex
,
1
)
}
removeElementByCid
(
cid
)
{
if
(
!
cid
)
{
return
}
this
.
elements
=
this
.
elements
.
filter
(
elm
=>
elm
.
cid
!==
cid
)
}
push
(
type
,
cid
,
data
,
options
)
{
const
typeData
=
[
cid
,
data
]
if
(
options
)
{
...
...
src/platforms/app-plus/service/framework/webview/parser/sub-nvue-parser.js
浏览文件 @
5d4ab082
...
...
@@ -121,6 +121,7 @@ function initSubNVue (subNVue, routeOptions, webview) {
`UNIAPP[webview][
${
webview
.
id
}
]:create[
${
subNVue
.
id
}
]:
${
JSON
.
stringify
(
style
)}
`
)
}
delete
style
.
mask
const
subNVueWebview
=
plus
.
webview
.
create
(
''
,
subNVue
.
id
,
style
,
extras
)
if
(
isPopup
)
{
...
...
src/platforms/app-plus/service/framework/webview/parser/title-nview-parser.js
浏览文件 @
5d4ab082
...
...
@@ -38,6 +38,9 @@ export function parseTitleNView (routeOptions) {
(
windowOptions
.
navigationStyle
===
'
custom
'
&&
!
isPlainObject
(
titleNView
)
)
||
(
windowOptions
.
transparentTitle
===
'
always
'
&&
!
isPlainObject
(
titleNView
)
)
)
{
return
false
...
...
@@ -56,7 +59,7 @@ export function parseTitleNView (routeOptions) {
titleText
:
titleImage
===
''
?
windowOptions
.
navigationBarTitleText
||
''
:
''
,
titleColor
:
windowOptions
.
navigationBarTextStyle
===
'
black
'
?
'
#000000
'
:
'
#ffffff
'
,
type
:
titleNViewTypeList
[
transparentTitle
],
backgroundColor
:
transparentTitle
!==
'
always
'
?
windowOptions
.
navigationBarBackgroundColor
||
'
#000000
'
:
'
rgba(0,0,0,0)
'
,
backgroundColor
:
windowOptions
.
navigationBarBackgroundColor
||
'
#f8f8f8
'
,
tags
:
titleImage
===
''
?
[]
:
[{
'
tag
'
:
'
img
'
,
'
src
'
:
titleImage
,
...
...
src/platforms/h5/components/page/index.vue
浏览文件 @
5d4ab082
...
...
@@ -39,6 +39,10 @@ import {
NAVBAR_HEIGHT
}
from
'
uni-helpers/constants
'
import
{
isPlainObject
}
from
'
uni-shared
'
import
{
mergeTitleNView
}
from
'
uni-helpers/patch
'
...
...
@@ -164,13 +168,27 @@ export default {
}
// 将 navigationStyle 和 transparentTitle 都合并到 titleNView
let
titleNView
=
this
.
titleNView
titleNView
=
Object
.
assign
({},
{
type
:
this
.
navigationStyle
===
'
custom
'
?
'
none
'
:
'
default
'
},
this
.
transparentTitle
in
titleNViewTypeList
?
{
type
:
titleNViewTypeList
[
this
.
transparentTitle
]
}
:
null
,
typeof
titleNView
===
'
object
'
?
titleNView
:
(
typeof
titleNView
===
'
boolean
'
?
{
type
:
titleNView
?
'
default
'
:
'
none
'
}
:
null
))
if
(
// 无头
titleNView
===
false
||
titleNView
===
'
false
'
||
(
this
.
navigationStyle
===
'
custom
'
&&
!
isPlainObject
(
titleNView
)
)
||
(
this
.
transparentTitle
===
'
always
'
&&
!
isPlainObject
(
titleNView
)
)
)
{
titleNView
=
{
type
:
'
none
'
}
}
else
{
titleNView
=
Object
.
assign
({},
{
type
:
this
.
navigationStyle
===
'
custom
'
?
'
none
'
:
'
default
'
},
this
.
transparentTitle
in
titleNViewTypeList
?
{
type
:
titleNViewTypeList
[
this
.
transparentTitle
]
}
:
null
,
typeof
titleNView
===
'
object
'
?
titleNView
:
(
typeof
titleNView
===
'
boolean
'
?
{
type
:
titleNView
?
'
default
'
:
'
none
'
}
:
null
))
}
const
yesNoParseList
=
{
'
YES
'
:
true
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录