Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wychl
uni-app
提交
dcadcc5e
U
uni-app
项目概览
wychl
/
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,发现更多精彩内容 >>
提交
dcadcc5e
编写于
6月 03, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(wxs): $ownerInstance
上级
134a4638
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
112 addition
and
68 deletion
+112
-68
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+86
-54
packages/uni-app-plus/dist/view.umd.min.js
packages/uni-app-plus/dist/view.umd.min.js
+2
-2
packages/uni-h5/dist/index.umd.min.js
packages/uni-h5/dist/index.umd.min.js
+1
-1
packages/uni-h5/manifest.json
packages/uni-h5/manifest.json
+4
-0
src/core/view/plugins/index.js
src/core/view/plugins/index.js
+9
-4
src/platforms/app-plus/service/framework/plugins/data.js
src/platforms/app-plus/service/framework/plugins/data.js
+2
-2
src/platforms/app-plus/service/framework/plugins/vdom-sync.js
...platforms/app-plus/service/framework/plugins/vdom-sync.js
+4
-3
src/platforms/app-plus/view/framework/plugins/data.js
src/platforms/app-plus/view/framework/plugins/data.js
+4
-2
未找到文件。
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
dcadcc5e
...
...
@@ -26,7 +26,8 @@ var serviceContext = (function () {
'
sendSocketMessage
'
,
'
onSocketMessage
'
,
'
closeSocket
'
,
'
onSocketClose
'
'
onSocketClose
'
,
'
getUpdateManager
'
];
const
route
=
[
...
...
@@ -70,7 +71,7 @@ var serviceContext = (function () {
'
saveVideoToPhotosAlbum
'
,
'
createVideoContext
'
,
'
createCameraContext
'
,
'
createLivePlayerContext
'
,
'
createLivePlayerContext
'
,
'
createLivePusherContext
'
];
...
...
@@ -126,7 +127,7 @@ var serviceContext = (function () {
'
stopBeaconDiscovery
'
,
'
checkIsSupportSoterAuthentication
'
,
'
checkIsSoterEnrolledInDevice
'
,
'
startSoterAuthentication
'
,
'
startSoterAuthentication
'
,
'
onUIStyleChange
'
];
...
...
@@ -165,7 +166,7 @@ var serviceContext = (function () {
'
startPullDownRefresh
'
,
'
stopPullDownRefresh
'
,
'
createSelectorQuery
'
,
'
createIntersectionObserver
'
,
'
createIntersectionObserver
'
,
'
getMenuButtonBoundingClientRect
'
];
...
...
@@ -212,14 +213,14 @@ var serviceContext = (function () {
'
upx2px
'
,
'
restoreGlobal
'
,
'
getSubNVueById
'
,
'
getCurrentSubNVue
'
,
'
setPageMeta
'
,
'
onNativeEventReceive
'
,
'
sendNativeEvent
'
,
'
getCurrentSubNVue
'
,
'
setPageMeta
'
,
'
onNativeEventReceive
'
,
'
sendNativeEvent
'
,
'
preloadPage
'
];
const
ad
=
[
const
ad
=
[
'
createRewardedVideoAd
'
];
...
...
@@ -236,7 +237,7 @@ var serviceContext = (function () {
...
event
,
...
file
,
...
canvas
,
...
third
,
...
third
,
...
ad
];
...
...
@@ -1626,7 +1627,7 @@ var serviceContext = (function () {
getProvider
:
getProvider
});
function
encodeQueryString
(
url
)
{
function
encodeQueryString
(
url
)
{
if
(
typeof
url
!==
'
string
'
)
{
return
url
}
...
...
@@ -1649,9 +1650,9 @@ var serviceContext = (function () {
query
.
split
(
'
&
'
).
forEach
(
param
=>
{
const
parts
=
param
.
replace
(
/
\+
/g
,
'
'
).
split
(
'
=
'
);
const
key
=
parts
.
shift
();
const
val
=
parts
.
length
>
0
?
parts
.
join
(
'
=
'
)
:
''
;
const
val
=
parts
.
length
>
0
?
parts
.
join
(
'
=
'
)
:
''
;
params
.
push
(
key
+
'
=
'
+
encodeURIComponent
(
val
));
});
...
...
@@ -1659,8 +1660,8 @@ var serviceContext = (function () {
return
params
.
length
?
url
+
'
?
'
+
params
.
join
(
'
&
'
)
:
url
}
function
createValidator
(
type
)
{
return
function
validator
(
url
,
params
)
{
function
createValidator
(
type
)
{
return
function
validator
(
url
,
params
)
{
// 格式化为绝对路径路由
url
=
getRealRoute
(
url
);
...
...
@@ -1733,24 +1734,24 @@ var serviceContext = (function () {
let
navigatorLock
;
function
createProtocol
(
type
,
extras
=
{})
{
function
createProtocol
(
type
,
extras
=
{})
{
return
Object
.
assign
({
url
:
{
type
:
String
,
required
:
true
,
validator
:
createValidator
(
type
)
},
beforeAll
()
{
beforeAll
()
{
navigatorLock
=
''
;
}
},
extras
)
}
function
createAnimationProtocol
(
animationTypes
)
{
function
createAnimationProtocol
(
animationTypes
)
{
return
{
animationType
:
{
type
:
String
,
validator
(
type
)
{
validator
(
type
)
{
if
(
type
&&
animationTypes
.
indexOf
(
type
)
===
-
1
)
{
return
'
`
'
+
type
+
'
` is not supported for `animationType` (supported values are: `
'
+
animationTypes
.
join
(
'
`|`
'
)
+
'
`)
'
...
...
@@ -1786,7 +1787,7 @@ var serviceContext = (function () {
const
navigateBack
=
Object
.
assign
({
delta
:
{
type
:
Number
,
validator
(
delta
,
params
)
{
validator
(
delta
,
params
)
{
delta
=
parseInt
(
delta
)
||
1
;
params
.
delta
=
Math
.
min
(
getCurrentPages
().
length
-
1
,
delta
);
}
...
...
@@ -8373,7 +8374,7 @@ var serviceContext = (function () {
const
pages
=
[];
function
getCurrentPages$1
(
returnAll
)
{
function
getCurrentPages$1
(
returnAll
)
{
return
returnAll
?
pages
.
slice
(
0
)
:
pages
.
filter
(
page
=>
{
return
!
page
.
$page
.
meta
.
isTabBar
||
page
.
$page
.
meta
.
visible
})
...
...
@@ -8381,7 +8382,7 @@ var serviceContext = (function () {
const
preloadWebviews
=
{};
function
preloadWebview$1
({
function
preloadWebview$1
({
url
,
path
,
query
...
...
@@ -8399,7 +8400,7 @@ var serviceContext = (function () {
/**
* 首页需要主动registerPage,二级页面路由跳转时registerPage
*/
function
registerPage
({
function
registerPage
({
url
,
path
,
query
,
...
...
@@ -8452,7 +8453,7 @@ var serviceContext = (function () {
const
pageInstance
=
{
route
,
options
:
Object
.
assign
({},
query
||
{}),
$getAppWebview
()
{
$getAppWebview
()
{
// 重要,不能直接返回 webview 对象,因为 plus 可能会被二次替换,返回的 webview 对象内部的 plus 不正确
// 导致 webview.getStyle 等逻辑出错(旧的 webview 内部 plus 被释放)
return
plus
.
webview
.
getWebviewById
(
webview
.
id
)
...
...
@@ -8464,7 +8465,7 @@ var serviceContext = (function () {
route
,
openType
},
$remove
()
{
$remove
()
{
const
index
=
pages
.
findIndex
(
page
=>
page
===
this
);
if
(
index
!==
-
1
)
{
if
(
!
webview
.
nvue
)
{
...
...
@@ -8477,10 +8478,10 @@ var serviceContext = (function () {
}
},
// 兼容小程序框架
selectComponent
(
selector
)
{
selectComponent
(
selector
)
{
return
this
.
$vm
.
selectComponent
(
selector
)
},
selectAllComponents
(
selector
)
{
selectAllComponents
(
selector
)
{
return
this
.
$vm
.
selectAllComponents
(
selector
)
}
};
...
...
@@ -8500,7 +8501,7 @@ var serviceContext = (function () {
)
{
plus
.
navigator
.
closeSplashscreen
();
}
__uniConfig
.
onReady
(
function
()
{
__uniConfig
.
onReady
(
function
()
{
navigateFinish
();
});
}
...
...
@@ -8780,7 +8781,7 @@ var serviceContext = (function () {
},
openType
===
'
appLaunch
'
);
}
function
preloadPage$1
({
function
preloadPage$1
({
url
},
callbackId
)
{
const
urls
=
url
.
split
(
'
?
'
);
...
...
@@ -11869,6 +11870,35 @@ var serviceContext = (function () {
onSocketClose
:
onSocketClose
});
class
UpdateManager
{
onCheckForUpdate
()
{
}
onUpdateReady
()
{
}
onUpdateFailed
()
{
}
applyUpdate
()
{
}
}
let
updateManager
;
function
getUpdateManager
()
{
return
updateManager
||
(
updateManager
=
new
UpdateManager
())
}
var
require_context_module_1_20
=
/*#__PURE__*/
Object
.
freeze
({
__proto__
:
null
,
getUpdateManager
:
getUpdateManager
});
class
UploadTask
{
constructor
(
uploadTaskId
,
callbackId
)
{
this
.
id
=
uploadTaskId
;
...
...
@@ -11958,7 +11988,7 @@ var serviceContext = (function () {
return
task
}
var
require_context_module_1_2
0
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
1
=
/*#__PURE__*/
Object
.
freeze
({
__proto__
:
null
,
uploadFile
:
uploadFile$1
});
...
...
@@ -12047,7 +12077,7 @@ var serviceContext = (function () {
return
new
MPAnimation
(
option
)
}
var
require_context_module_1_2
1
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
2
=
/*#__PURE__*/
Object
.
freeze
({
__proto__
:
null
,
createAnimation
:
createAnimation
});
...
...
@@ -12117,7 +12147,7 @@ var serviceContext = (function () {
return
new
ServiceIntersectionObserver
(
getCurrentPageVm
(
'
createIntersectionObserver
'
),
options
)
}
var
require_context_module_1_2
2
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
3
=
/*#__PURE__*/
Object
.
freeze
({
__proto__
:
null
,
createIntersectionObserver
:
createIntersectionObserver
});
...
...
@@ -12258,7 +12288,7 @@ var serviceContext = (function () {
return
new
SelectorQuery
(
getCurrentPageVm
(
'
createSelectorQuery
'
))
}
var
require_context_module_1_2
3
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
4
=
/*#__PURE__*/
Object
.
freeze
({
__proto__
:
null
,
createSelectorQuery
:
createSelectorQuery
});
...
...
@@ -12275,7 +12305,7 @@ var serviceContext = (function () {
callback$1
=
callbackId
;
}
var
require_context_module_1_2
4
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
5
=
/*#__PURE__*/
Object
.
freeze
({
__proto__
:
null
,
onKeyboardHeightChange
:
onKeyboardHeightChange
});
...
...
@@ -12300,7 +12330,7 @@ var serviceContext = (function () {
},
pageId
);
}
var
require_context_module_1_2
5
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
6
=
/*#__PURE__*/
Object
.
freeze
({
__proto__
:
null
,
loadFontFace
:
loadFontFace$1
});
...
...
@@ -12313,7 +12343,7 @@ var serviceContext = (function () {
return
{}
}
var
require_context_module_1_2
6
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
7
=
/*#__PURE__*/
Object
.
freeze
({
__proto__
:
null
,
pageScrollTo
:
pageScrollTo$1
});
...
...
@@ -12326,7 +12356,7 @@ var serviceContext = (function () {
return
{}
}
var
require_context_module_1_2
7
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
8
=
/*#__PURE__*/
Object
.
freeze
({
__proto__
:
null
,
setPageMeta
:
setPageMeta
});
...
...
@@ -12363,7 +12393,7 @@ var serviceContext = (function () {
callbacks$c
.
push
(
callbackId
);
}
var
require_context_module_1_2
8
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
9
=
/*#__PURE__*/
Object
.
freeze
({
__proto__
:
null
,
removeTabBarBadge
:
removeTabBarBadge$1
,
showTabBarRedDot
:
showTabBarRedDot$1
,
...
...
@@ -12389,7 +12419,7 @@ var serviceContext = (function () {
callbacks$d
.
splice
(
callbacks$d
.
indexOf
(
callbackId
),
1
);
}
var
require_context_module_1_
29
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_
30
=
/*#__PURE__*/
Object
.
freeze
({
__proto__
:
null
,
onWindowResize
:
onWindowResize
,
offWindowResize
:
offWindowResize
...
...
@@ -12420,16 +12450,17 @@ var serviceContext = (function () {
'
./network/download-file.js
'
:
require_context_module_1_17
,
'
./network/request.js
'
:
require_context_module_1_18
,
'
./network/socket.js
'
:
require_context_module_1_19
,
'
./network/upload-file.js
'
:
require_context_module_1_20
,
'
./ui/create-animation.js
'
:
require_context_module_1_21
,
'
./ui/create-intersection-observer.js
'
:
require_context_module_1_22
,
'
./ui/create-selector-query.js
'
:
require_context_module_1_23
,
'
./ui/keyboard.js
'
:
require_context_module_1_24
,
'
./ui/load-font-face.js
'
:
require_context_module_1_25
,
'
./ui/page-scroll-to.js
'
:
require_context_module_1_26
,
'
./ui/set-page-meta.js
'
:
require_context_module_1_27
,
'
./ui/tab-bar.js
'
:
require_context_module_1_28
,
'
./ui/window.js
'
:
require_context_module_1_29
,
'
./network/update.js
'
:
require_context_module_1_20
,
'
./network/upload-file.js
'
:
require_context_module_1_21
,
'
./ui/create-animation.js
'
:
require_context_module_1_22
,
'
./ui/create-intersection-observer.js
'
:
require_context_module_1_23
,
'
./ui/create-selector-query.js
'
:
require_context_module_1_24
,
'
./ui/keyboard.js
'
:
require_context_module_1_25
,
'
./ui/load-font-face.js
'
:
require_context_module_1_26
,
'
./ui/page-scroll-to.js
'
:
require_context_module_1_27
,
'
./ui/set-page-meta.js
'
:
require_context_module_1_28
,
'
./ui/tab-bar.js
'
:
require_context_module_1_29
,
'
./ui/window.js
'
:
require_context_module_1_30
,
};
var
req
=
function
req
(
key
)
{
...
...
@@ -13352,9 +13383,10 @@ var serviceContext = (function () {
}
class
VDomSync
{
constructor
(
pageId
,
pagePath
,
pageVm
)
{
constructor
(
pageId
,
pagePath
,
page
Query
,
page
Vm
)
{
this
.
pageId
=
pageId
;
this
.
pagePath
=
pagePath
;
this
.
pageQuery
=
pageQuery
;
this
.
pageVm
=
pageVm
;
this
.
batchData
=
[];
this
.
vms
=
Object
.
create
(
null
);
...
...
@@ -13451,7 +13483,7 @@ var serviceContext = (function () {
flush
()
{
if
(
!
this
.
initialized
)
{
this
.
initialized
=
true
;
this
.
batchData
.
push
([
PAGE_CREATED
,
[
this
.
pageId
,
this
.
pagePath
]]);
this
.
batchData
.
push
([
PAGE_CREATED
,
[
this
.
pageId
,
this
.
pagePath
,
this
.
pageQuery
]]);
}
const
batchData
=
this
.
batchData
.
filter
(
data
=>
{
if
(
data
[
0
]
===
UPDATED_DATA
&&
!
Object
.
keys
(
data
[
1
][
1
]).
length
)
{
...
...
@@ -13486,7 +13518,7 @@ var serviceContext = (function () {
}
restorePageCreated
()
{
this
.
batchData
.
push
([
PAGE_CREATED
,
[
this
.
pageId
,
this
.
pagePath
]]);
this
.
batchData
.
push
([
PAGE_CREATED
,
[
this
.
pageId
,
this
.
pagePath
,
this
.
pageQuery
]]);
}
restore
()
{
...
...
@@ -13608,7 +13640,7 @@ var serviceContext = (function () {
return
}
if
(
this
.
mpType
===
'
page
'
)
{
this
.
_$vdomSync
=
new
VDomSync
(
this
.
$options
.
pageId
,
this
.
$options
.
pagePath
,
this
);
this
.
_$vdomSync
=
new
VDomSync
(
this
.
$options
.
pageId
,
this
.
$options
.
pagePath
,
this
.
$options
.
pageQuery
,
this
);
}
if
(
this
.
_$vd
)
{
this
.
_$id
=
generateId
(
this
,
this
.
$parent
);
...
...
packages/uni-app-plus/dist/view.umd.min.js
浏览文件 @
dcadcc5e
此差异已折叠。
点击以展开。
packages/uni-h5/dist/index.umd.min.js
浏览文件 @
dcadcc5e
此差异已折叠。
点击以展开。
packages/uni-h5/manifest.json
浏览文件 @
dcadcc5e
...
...
@@ -105,6 +105,10 @@
"/platforms/h5/service/api/network/socket.js"
,
[]
],
"getUpdateManager"
:
[
"/core/service/api/network/update.js"
,
[]
],
"navigateTo"
:
[
"/platforms/h5/service/api/route/route.js"
,
[
...
...
src/core/view/plugins/index.js
浏览文件 @
dcadcc5e
...
...
@@ -48,10 +48,16 @@ export default {
return
$event
}
Vue
.
prototype
.
$getComponentDescriptor
=
function
(
vm
,
isOwnerInstance
)
{
return
createComponentDescriptor
(
vm
||
this
,
isOwnerInstance
)
Vue
.
prototype
.
$getComponentDescriptor
=
function
(
vm
,
isOwnerInstance
)
{
return
createComponentDescriptor
(
vm
||
this
,
isOwnerInstance
)
}
Object
.
defineProperty
(
Vue
.
prototype
,
'
$ownerInstance
'
,
{
get
()
{
return
this
.
$getComponentDescriptor
(
this
)
}
})
Vue
.
prototype
.
$handleWxsEvent
=
function
(
$event
)
{
if
(
$event
instanceof
Event
)
{
// 未处理的 event 对象 需要对 target 校正及包装
const
currentTarget
=
$event
.
currentTarget
...
...
@@ -80,12 +86,11 @@ export default {
initBehaviors
(
options
,
this
)
}
if
(
isPage
(
this
))
{
if
(
__PLATFORM__
===
'
h5
'
&&
isPage
(
this
))
{
options
.
mounted
=
options
.
mounted
?
[].
concat
(
pageMounted
,
options
.
mounted
)
:
[
pageMounted
]
}
}
})
// TODO 跨平台时,View 层需要注入$page属性
}
}
src/platforms/app-plus/service/framework/plugins/data.js
浏览文件 @
dcadcc5e
...
...
@@ -21,7 +21,7 @@ import {
B_CLASS
,
B_STYLE
,
S_CLASS
}
from
'
../../constants
'
}
from
'
../../constants
'
import
{
generateId
...
...
@@ -85,7 +85,7 @@ export function initData (Vue) {
return
}
if
(
this
.
mpType
===
'
page
'
)
{
this
.
_$vdomSync
=
new
VDomSync
(
this
.
$options
.
pageId
,
this
.
$options
.
pagePath
,
this
)
this
.
_$vdomSync
=
new
VDomSync
(
this
.
$options
.
pageId
,
this
.
$options
.
pagePath
,
this
.
$options
.
pageQuery
,
this
)
}
if
(
this
.
_$vd
)
{
this
.
_$id
=
generateId
(
this
,
this
.
$parent
)
...
...
src/platforms/app-plus/service/framework/plugins/vdom-sync.js
浏览文件 @
dcadcc5e
...
...
@@ -90,9 +90,10 @@ function onVdSync (vdBatchData, vd) {
}
export
class
VDomSync
{
constructor
(
pageId
,
pagePath
,
pageVm
)
{
constructor
(
pageId
,
pagePath
,
page
Query
,
page
Vm
)
{
this
.
pageId
=
pageId
this
.
pagePath
=
pagePath
this
.
pageQuery
=
pageQuery
this
.
pageVm
=
pageVm
this
.
batchData
=
[]
this
.
vms
=
Object
.
create
(
null
)
...
...
@@ -189,7 +190,7 @@ export class VDomSync {
flush
()
{
if
(
!
this
.
initialized
)
{
this
.
initialized
=
true
this
.
batchData
.
push
([
PAGE_CREATED
,
[
this
.
pageId
,
this
.
pagePath
]])
this
.
batchData
.
push
([
PAGE_CREATED
,
[
this
.
pageId
,
this
.
pagePath
,
this
.
pageQuery
]])
}
const
batchData
=
this
.
batchData
.
filter
(
data
=>
{
if
(
data
[
0
]
===
UPDATED_DATA
&&
!
Object
.
keys
(
data
[
1
][
1
]).
length
)
{
...
...
@@ -224,7 +225,7 @@ export class VDomSync {
}
restorePageCreated
()
{
this
.
batchData
.
push
([
PAGE_CREATED
,
[
this
.
pageId
,
this
.
pagePath
]])
this
.
batchData
.
push
([
PAGE_CREATED
,
[
this
.
pageId
,
this
.
pagePath
,
this
.
pageQuery
]])
}
restore
()
{
...
...
src/platforms/app-plus/view/framework/plugins/data.js
浏览文件 @
dcadcc5e
...
...
@@ -52,12 +52,14 @@ const handleData = {
vd
.
updateVData
.
apply
(
vd
,
data
)
},
[
PAGE_CREATED
]:
function
onPageCreated
(
data
)
{
const
[
pageId
,
pagePath
]
=
data
const
[
pageId
,
pagePath
,
pageQuery
]
=
data
const
page
=
getCurrentPages
()[
0
]
page
.
options
=
pageQuery
||
{}
page
.
$vm
=
new
PageVueComponent
({
mpType
:
'
page
'
,
pageId
,
pagePath
pagePath
,
pageQuery
}).
$mount
(
'
#app
'
)
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录