Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
r15132706585
uni-app
提交
d9d838a1
U
uni-app
项目概览
r15132706585
/
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,发现更多精彩内容 >>
提交
d9d838a1
编写于
5月 17, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(mp): alipay parent,children
上级
c2cfb8e6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
74 addition
and
50 deletion
+74
-50
packages/uni-mp-alipay/dist/index.js
packages/uni-mp-alipay/dist/index.js
+34
-23
src/platforms/app-plus/service/api/sub-nvue.js
src/platforms/app-plus/service/api/sub-nvue.js
+18
-16
src/platforms/mp-alipay/runtime/wrapper/component-parser.js
src/platforms/mp-alipay/runtime/wrapper/component-parser.js
+8
-5
src/platforms/mp-alipay/runtime/wrapper/page-parser.js
src/platforms/mp-alipay/runtime/wrapper/page-parser.js
+2
-1
src/platforms/mp-alipay/runtime/wrapper/util.js
src/platforms/mp-alipay/runtime/wrapper/util.js
+12
-5
未找到文件。
packages/uni-mp-alipay/dist/index.js
浏览文件 @
d9d838a1
...
@@ -40,7 +40,7 @@ const camelize = cached((str) => {
...
@@ -40,7 +40,7 @@ const camelize = cached((str) => {
return
str
.
replace
(
camelizeRE
,
(
_
,
c
)
=>
c
?
c
.
toUpperCase
()
:
''
)
return
str
.
replace
(
camelizeRE
,
(
_
,
c
)
=>
c
?
c
.
toUpperCase
()
:
''
)
});
});
const
SYNC_API_RE
=
/subNVue|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/
;
const
SYNC_API_RE
=
/subNVue|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$
|base64ToArrayBuffer|arrayBufferToBase64
/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
...
@@ -88,17 +88,17 @@ function promisify (name, api) {
...
@@ -88,17 +88,17 @@ function promisify (name, api) {
success
:
resolve
,
success
:
resolve
,
fail
:
reject
fail
:
reject
}),
...
params
);
}),
...
params
);
/* eslint-disable no-extend-native */
/* eslint-disable no-extend-native */
if
(
!
Promise
.
prototype
.
finally
)
{
if
(
!
Promise
.
prototype
.
finally
)
{
Promise
.
prototype
.
finally
=
function
(
callback
)
{
Promise
.
prototype
.
finally
=
function
(
callback
)
{
const
promise
=
this
.
constructor
;
const
promise
=
this
.
constructor
;
return
this
.
then
(
return
this
.
then
(
value
=>
promise
.
resolve
(
callback
()).
then
(()
=>
value
),
value
=>
promise
.
resolve
(
callback
()).
then
(()
=>
value
),
reason
=>
promise
.
resolve
(
callback
()).
then
(()
=>
{
reason
=>
promise
.
resolve
(
callback
()).
then
(()
=>
{
throw
reason
throw
reason
})
})
)
)
};
};
}
}
}))
}))
}
}
...
@@ -1271,12 +1271,16 @@ function initRelation$1 (detail) {
...
@@ -1271,12 +1271,16 @@ function initRelation$1 (detail) {
}
}
function
initChildVues
(
mpInstance
)
{
function
initChildVues
(
mpInstance
)
{
// 此时需保证当前 mpInstance 已经存在 $vm
if
(
!
mpInstance
.
$vm
)
{
return
}
mpInstance
.
_$childVues
&&
mpInstance
.
_$childVues
.
forEach
(({
mpInstance
.
_$childVues
&&
mpInstance
.
_$childVues
.
forEach
(({
vuePid
,
vuePid
,
vueOptions
,
vueOptions
,
VueComponent
,
VueComponent
,
mpInstance
:
childMPInstance
mpInstance
:
childMPInstance
})
=>
{
})
=>
{
// 父子关系
// 父子关系
handleLink
.
call
(
mpInstance
,
{
handleLink
.
call
(
mpInstance
,
{
detail
:
{
detail
:
{
...
@@ -1285,12 +1289,15 @@ function initChildVues (mpInstance) {
...
@@ -1285,12 +1289,15 @@ function initChildVues (mpInstance) {
}
}
});
});
childMPInstance
.
$vm
=
new
VueComponent
(
vueOptions
);
childMPInstance
.
$vm
=
new
VueComponent
(
vueOptions
);
handleRef
.
call
(
vueOptions
.
parent
.
$scope
,
childMPInstance
);
handleRef
.
call
(
vueOptions
.
parent
.
$scope
,
childMPInstance
);
childMPInstance
.
$vm
.
$mount
();
childMPInstance
.
$vm
.
$mount
();
initChildVues
(
childMPInstance
);
console
.
log
(
childMPInstance
.
is
,
'
mounted
'
);
childMPInstance
.
$vm
.
_isMounted
=
true
;
childMPInstance
.
$vm
.
_isMounted
=
true
;
childMPInstance
.
$vm
.
__call_hook
(
'
mounted
'
);
childMPInstance
.
$vm
.
__call_hook
(
'
mounted
'
);
childMPInstance
.
$vm
.
__call_hook
(
'
onReady
'
);
childMPInstance
.
$vm
.
__call_hook
(
'
onReady
'
);
...
@@ -1364,7 +1371,7 @@ const handleLink$1 = (function () {
...
@@ -1364,7 +1371,7 @@ const handleLink$1 = (function () {
}
}
}
}
return
function
handleLink$$1
(
detail
)
{
return
function
handleLink$$1
(
detail
)
{
if
(
this
.
$vm
)
{
// 父已初始化
if
(
this
.
$vm
&&
this
.
$vm
.
_isMounted
)
{
// 父已初始化
return
handleLink
.
call
(
this
,
{
return
handleLink
.
call
(
this
,
{
detail
:
{
detail
:
{
vuePid
:
detail
.
vuePid
,
vuePid
:
detail
.
vuePid
,
...
@@ -1443,7 +1450,8 @@ function parsePage (vuePageOptions) {
...
@@ -1443,7 +1450,8 @@ function parsePage (vuePageOptions) {
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
);
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
);
},
},
onReady
()
{
onReady
()
{
initChildVues
(
this
);
initChildVues
(
this
);
console
.
log
(
this
.
route
,
'
mounted
'
);
this
.
$vm
.
_isMounted
=
true
;
this
.
$vm
.
_isMounted
=
true
;
this
.
$vm
.
__call_hook
(
'
mounted
'
);
this
.
$vm
.
__call_hook
(
'
mounted
'
);
this
.
$vm
.
__call_hook
(
'
onReady
'
);
this
.
$vm
.
__call_hook
(
'
onReady
'
);
...
@@ -1494,22 +1502,25 @@ function initVm (VueComponent) {
...
@@ -1494,22 +1502,25 @@ function initVm (VueComponent) {
// 触发首次 setData
// 触发首次 setData
this
.
$vm
.
$mount
();
this
.
$vm
.
$mount
();
}
else
{
}
else
{
initChildVues
(
this
);
// 处理父子关系
// 处理父子关系
initRelation$1
.
call
(
this
,
{
initRelation$1
.
call
(
this
,
{
vuePid
:
this
.
_$vuePid
,
vuePid
:
this
.
_$vuePid
,
vueOptions
:
options
,
vueOptions
:
options
,
VueComponent
,
VueComponent
,
mpInstance
:
this
mpInstance
:
this
});
});
if
(
options
.
parent
)
{
// 父组件已经初始化,直接初始化子,否则放到父组件的 didMount 中处理
if
(
options
.
parent
)
{
// 父组件已经初始化,直接初始化子,否则放到父组件的 didMount 中处理
// 初始化 vue 实例
// 初始化 vue 实例
this
.
$vm
=
new
VueComponent
(
options
);
this
.
$vm
=
new
VueComponent
(
options
);
handleRef
.
call
(
options
.
parent
.
$scope
,
this
);
handleRef
.
call
(
options
.
parent
.
$scope
,
this
);
// 触发首次 setData
// 触发首次 setData
this
.
$vm
.
$mount
();
this
.
$vm
.
$mount
();
initChildVues
(
this
);
console
.
log
(
this
.
is
,
'
mounted
'
);
this
.
$vm
.
_isMounted
=
true
;
this
.
$vm
.
_isMounted
=
true
;
this
.
$vm
.
__call_hook
(
'
mounted
'
);
this
.
$vm
.
__call_hook
(
'
mounted
'
);
this
.
$vm
.
__call_hook
(
'
onReady
'
);
this
.
$vm
.
__call_hook
(
'
onReady
'
);
...
...
src/platforms/app-plus/service/api/sub-nvue.js
浏览文件 @
d9d838a1
function
wrapper
(
webview
)
{
function
wrapper
(
webview
)
{
webview
.
$processed
=
true
webview
.
$processed
=
true
webview
.
postMessage
=
function
(
data
)
{
plus
.
webview
.
postMessageToUniNView
({
type
:
'
UniAppSubNVue
'
,
data
,
options
:
{
id
:
webview
.
id
}
},
webview
.
id
)
}
let
callbacks
=
[]
webview
.
onMessage
=
function
(
callback
)
{
callbacks
.
push
(
callback
)
}
webview
.
$consumeMessage
=
function
(
e
)
{
callbacks
.
forEach
(
callback
=>
callback
(
e
))
}
if
(
!
webview
.
__uniapp_mask_id
)
{
if
(
!
webview
.
__uniapp_mask_id
)
{
return
return
}
}
...
@@ -32,22 +50,6 @@ function wrapper (webview) {
...
@@ -32,22 +50,6 @@ function wrapper (webview) {
callbacks
=
[]
callbacks
=
[]
return
oldClose
.
apply
(
webview
,
args
)
return
oldClose
.
apply
(
webview
,
args
)
}
}
webview
.
postMessage
=
function
(
data
)
{
plus
.
webview
.
postMessageToUniNView
({
type
:
'
UniAppSubNVue
'
,
data
,
options
:
{
id
:
webview
.
id
}
},
webview
.
id
)
}
let
callbacks
=
[]
webview
.
onMessage
=
function
(
callback
)
{
callbacks
.
push
(
callback
)
}
webview
.
$consumeMessage
=
function
(
e
)
{
callbacks
.
forEach
(
callback
=>
callback
(
e
))
}
}
}
export
const
subNVue
=
{
export
const
subNVue
=
{
...
...
src/platforms/mp-alipay/runtime/wrapper/component-parser.js
浏览文件 @
d9d838a1
...
@@ -46,22 +46,25 @@ function initVm (VueComponent) {
...
@@ -46,22 +46,25 @@ function initVm (VueComponent) {
// 触发首次 setData
// 触发首次 setData
this
.
$vm
.
$mount
()
this
.
$vm
.
$mount
()
}
else
{
}
else
{
initChildVues
(
this
)
// 处理父子关系
// 处理父子关系
initRelation
.
call
(
this
,
{
initRelation
.
call
(
this
,
{
vuePid
:
this
.
_$vuePid
,
vuePid
:
this
.
_$vuePid
,
vueOptions
:
options
,
vueOptions
:
options
,
VueComponent
,
VueComponent
,
mpInstance
:
this
mpInstance
:
this
})
})
if
(
options
.
parent
)
{
// 父组件已经初始化,直接初始化子,否则放到父组件的 didMount 中处理
if
(
options
.
parent
)
{
// 父组件已经初始化,直接初始化子,否则放到父组件的 didMount 中处理
// 初始化 vue 实例
// 初始化 vue 实例
this
.
$vm
=
new
VueComponent
(
options
)
this
.
$vm
=
new
VueComponent
(
options
)
handleRef
.
call
(
options
.
parent
.
$scope
,
this
)
handleRef
.
call
(
options
.
parent
.
$scope
,
this
)
// 触发首次 setData
// 触发首次 setData
this
.
$vm
.
$mount
()
this
.
$vm
.
$mount
()
initChildVues
(
this
)
console
.
log
(
this
.
is
,
'
mounted
'
)
this
.
$vm
.
_isMounted
=
true
this
.
$vm
.
_isMounted
=
true
this
.
$vm
.
__call_hook
(
'
mounted
'
)
this
.
$vm
.
__call_hook
(
'
mounted
'
)
this
.
$vm
.
__call_hook
(
'
onReady
'
)
this
.
$vm
.
__call_hook
(
'
onReady
'
)
...
...
src/platforms/mp-alipay/runtime/wrapper/page-parser.js
浏览文件 @
d9d838a1
...
@@ -53,7 +53,8 @@ export default function parsePage (vuePageOptions) {
...
@@ -53,7 +53,8 @@ export default function parsePage (vuePageOptions) {
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
)
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
)
},
},
onReady
()
{
onReady
()
{
initChildVues
(
this
)
initChildVues
(
this
)
console
.
log
(
this
.
route
,
'
mounted
'
)
this
.
$vm
.
_isMounted
=
true
this
.
$vm
.
_isMounted
=
true
this
.
$vm
.
__call_hook
(
'
mounted
'
)
this
.
$vm
.
__call_hook
(
'
mounted
'
)
this
.
$vm
.
__call_hook
(
'
onReady
'
)
this
.
$vm
.
__call_hook
(
'
onReady
'
)
...
...
src/platforms/mp-alipay/runtime/wrapper/util.js
浏览文件 @
d9d838a1
...
@@ -43,12 +43,16 @@ export function initRelation (detail) {
...
@@ -43,12 +43,16 @@ export function initRelation (detail) {
}
}
export
function
initChildVues
(
mpInstance
)
{
export
function
initChildVues
(
mpInstance
)
{
// 此时需保证当前 mpInstance 已经存在 $vm
if
(
!
mpInstance
.
$vm
)
{
return
}
mpInstance
.
_$childVues
&&
mpInstance
.
_$childVues
.
forEach
(({
mpInstance
.
_$childVues
&&
mpInstance
.
_$childVues
.
forEach
(({
vuePid
,
vuePid
,
vueOptions
,
vueOptions
,
VueComponent
,
VueComponent
,
mpInstance
:
childMPInstance
mpInstance
:
childMPInstance
})
=>
{
})
=>
{
// 父子关系
// 父子关系
handleBaseLink
.
call
(
mpInstance
,
{
handleBaseLink
.
call
(
mpInstance
,
{
detail
:
{
detail
:
{
...
@@ -57,12 +61,15 @@ export function initChildVues (mpInstance) {
...
@@ -57,12 +61,15 @@ export function initChildVues (mpInstance) {
}
}
})
})
childMPInstance
.
$vm
=
new
VueComponent
(
vueOptions
)
childMPInstance
.
$vm
=
new
VueComponent
(
vueOptions
)
handleRef
.
call
(
vueOptions
.
parent
.
$scope
,
childMPInstance
)
handleRef
.
call
(
vueOptions
.
parent
.
$scope
,
childMPInstance
)
childMPInstance
.
$vm
.
$mount
()
childMPInstance
.
$vm
.
$mount
()
initChildVues
(
childMPInstance
)
console
.
log
(
childMPInstance
.
is
,
'
mounted
'
)
childMPInstance
.
$vm
.
_isMounted
=
true
childMPInstance
.
$vm
.
_isMounted
=
true
childMPInstance
.
$vm
.
__call_hook
(
'
mounted
'
)
childMPInstance
.
$vm
.
__call_hook
(
'
mounted
'
)
childMPInstance
.
$vm
.
__call_hook
(
'
onReady
'
)
childMPInstance
.
$vm
.
__call_hook
(
'
onReady
'
)
...
@@ -136,7 +143,7 @@ export const handleLink = (function () {
...
@@ -136,7 +143,7 @@ export const handleLink = (function () {
}
}
}
}
return
function
handleLink
(
detail
)
{
return
function
handleLink
(
detail
)
{
if
(
this
.
$vm
)
{
// 父已初始化
if
(
this
.
$vm
&&
this
.
$vm
.
_isMounted
)
{
// 父已初始化
return
handleBaseLink
.
call
(
this
,
{
return
handleBaseLink
.
call
(
this
,
{
detail
:
{
detail
:
{
vuePid
:
detail
.
vuePid
,
vuePid
:
detail
.
vuePid
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录