Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Velpro187
uni-app
提交
44ddf729
U
uni-app
项目概览
Velpro187
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
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,发现更多精彩内容 >>
提交
44ddf729
编写于
4月 11, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(mp): subpackage (#3416)
上级
002161aa
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
42 addition
and
14 deletion
+42
-14
packages/uni-mp-baidu/src/runtime/index.ts
packages/uni-mp-baidu/src/runtime/index.ts
+2
-1
packages/uni-mp-core/src/runtime/app.ts
packages/uni-mp-core/src/runtime/app.ts
+12
-5
packages/uni-mp-core/src/runtime/component.ts
packages/uni-mp-core/src/runtime/component.ts
+11
-1
packages/uni-mp-core/src/runtime/plugin.ts
packages/uni-mp-core/src/runtime/plugin.ts
+3
-0
packages/uni-mp-kuaishou/src/runtime/index.ts
packages/uni-mp-kuaishou/src/runtime/index.ts
+2
-1
packages/uni-mp-lark/src/runtime/index.ts
packages/uni-mp-lark/src/runtime/index.ts
+2
-1
packages/uni-mp-qq/src/runtime/index.ts
packages/uni-mp-qq/src/runtime/index.ts
+2
-1
packages/uni-mp-toutiao/src/runtime/index.ts
packages/uni-mp-toutiao/src/runtime/index.ts
+2
-1
packages/uni-mp-weixin/src/runtime/index.ts
packages/uni-mp-weixin/src/runtime/index.ts
+4
-2
packages/uni-quickapp-webview/src/runtime/index.ts
packages/uni-quickapp-webview/src/runtime/index.ts
+2
-1
未找到文件。
packages/uni-mp-baidu/src/runtime/index.ts
浏览文件 @
44ddf729
...
...
@@ -20,4 +20,5 @@ export const createSubpackageApp = initCreateSubpackageApp(parseAppOptions)
;(
swan
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
swan
as
any
).
createPage
=
createPage
;(
swan
as
any
).
createComponent
=
createComponent
;(
swan
as
any
).
createSubpackageApp
=
createSubpackageApp
;(
swan
as
any
).
createSubpackageApp
=
(
global
as
any
).
createSubpackageApp
=
createSubpackageApp
packages/uni-mp-core/src/runtime/app.ts
浏览文件 @
44ddf729
...
...
@@ -106,6 +106,13 @@ export function initCreateSubpackageApp(parseAppOptions?: ParseAppOptions) {
}
})
initAppLifecycle
(
appOptions
,
vm
)
if
(
process
.
env
.
UNI_SUBPACKAGE
)
{
;(
__GLOBAL__
.
$subpackages
||
(
__GLOBAL__
.
$subpackages
=
{}))[
process
.
env
.
UNI_SUBPACKAGE
]
=
{
$vm
:
vm
,
}
}
}
}
...
...
@@ -113,6 +120,11 @@ export function initAppLifecycle(
appOptions
:
MiniProgramAppOptions
,
vm
:
ComponentPublicInstance
)
{
if
(
isFunction
(
appOptions
.
onLaunch
))
{
const
args
=
__GLOBAL__
.
getLaunchOptionsSync
&&
__GLOBAL__
.
getLaunchOptionsSync
()
appOptions
.
onLaunch
(
args
)
}
if
(
isFunction
(
appOptions
.
onShow
)
&&
__GLOBAL__
.
onAppShow
)
{
__GLOBAL__
.
onAppShow
((
args
:
unknown
)
=>
{
vm
.
$callHook
(
'
onShow
'
,
args
)
...
...
@@ -123,11 +135,6 @@ export function initAppLifecycle(
vm
.
$callHook
(
'
onHide
'
,
args
)
})
}
if
(
isFunction
(
appOptions
.
onLaunch
))
{
const
args
=
__GLOBAL__
.
getLaunchOptionsSync
&&
__GLOBAL__
.
getLaunchOptionsSync
()
vm
.
$callHook
(
'
onLaunch
'
,
args
||
{})
}
}
function
initLocale
(
appVm
:
ComponentPublicInstance
)
{
...
...
packages/uni-mp-core/src/runtime/component.ts
浏览文件 @
44ddf729
...
...
@@ -144,12 +144,22 @@ interface InitialVNode {
props
:
Record
<
string
,
any
>
}
function
getAppVm
()
{
if
(
process
.
env
.
UNI_MP_PLUGIN
)
{
return
__GLOBAL__
.
$vm
}
if
(
process
.
env
.
UNI_SUBPACKAGE
)
{
return
__GLOBAL__
.
$subpackages
[
process
.
env
.
UNI_SUBPACKAGE
].
$vm
}
return
getApp
().
$vm
}
export
function
$createComponent
(
initialVNode
:
InitialVNode
,
options
:
CreateComponentOptions
)
{
if
(
!
$createComponentFn
)
{
$createComponentFn
=
getApp
().
$vm
.
$createComponent
$createComponentFn
=
getApp
Vm
()
.
$createComponent
}
const
proxy
=
$createComponentFn
(
initialVNode
,
...
...
packages/uni-mp-core/src/runtime/plugin.ts
浏览文件 @
44ddf729
...
...
@@ -4,5 +4,8 @@ import { initAppLifecycle, parseApp, ParseAppOptions } from './app'
export
function
initCreatePluginApp
(
parseAppOptions
?:
ParseAppOptions
)
{
return
function
createApp
(
vm
:
ComponentPublicInstance
)
{
initAppLifecycle
(
parseApp
(
vm
,
parseAppOptions
),
vm
)
if
(
process
.
env
.
UNI_MP_PLUGIN
)
{
__GLOBAL__
.
$vm
=
vm
}
}
}
packages/uni-mp-kuaishou/src/runtime/index.ts
浏览文件 @
44ddf729
...
...
@@ -18,4 +18,5 @@ export const createSubpackageApp = initCreateSubpackageApp()
;(
ks
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
ks
as
any
).
createPage
=
createPage
;(
ks
as
any
).
createComponent
=
createComponent
;(
ks
as
any
).
createSubpackageApp
=
createSubpackageApp
;(
ks
as
any
).
createSubpackageApp
=
(
global
as
any
).
createSubpackageApp
=
createSubpackageApp
packages/uni-mp-lark/src/runtime/index.ts
浏览文件 @
44ddf729
...
...
@@ -19,4 +19,5 @@ export const createSubpackageApp = initCreateSubpackageApp()
;(
tt
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
tt
as
any
).
createPage
=
createPage
;(
tt
as
any
).
createComponent
=
createComponent
;(
tt
as
any
).
createSubpackageApp
=
createSubpackageApp
;(
tt
as
any
).
createSubpackageApp
=
(
global
as
any
).
createSubpackageApp
=
createSubpackageApp
packages/uni-mp-qq/src/runtime/index.ts
浏览文件 @
44ddf729
...
...
@@ -11,4 +11,5 @@ export * from '@dcloudio/uni-mp-weixin/src/runtime'
;(
qq
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
qq
as
any
).
createPage
=
createPage
;(
qq
as
any
).
createComponent
=
createComponent
;(
qq
as
any
).
createSubpackageApp
=
createSubpackageApp
;(
qq
as
any
).
createSubpackageApp
=
(
global
as
any
).
createSubpackageApp
=
createSubpackageApp
packages/uni-mp-toutiao/src/runtime/index.ts
浏览文件 @
44ddf729
...
...
@@ -19,4 +19,5 @@ export const createSubpackageApp = initCreateSubpackageApp()
;(
tt
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
tt
as
any
).
createPage
=
createPage
;(
tt
as
any
).
createComponent
=
createComponent
;(
tt
as
any
).
createSubpackageApp
=
createSubpackageApp
;(
tt
as
any
).
createSubpackageApp
=
(
global
as
any
).
createSubpackageApp
=
createSubpackageApp
packages/uni-mp-weixin/src/runtime/index.ts
浏览文件 @
44ddf729
...
...
@@ -19,6 +19,8 @@ if (__PLATFORM__ === 'mp-weixin') {
;(
wx
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
wx
as
any
).
createPage
=
createPage
;(
wx
as
any
).
createComponent
=
createComponent
;(
wx
as
any
).
createPluginApp
=
createPluginApp
;(
wx
as
any
).
createSubpackageApp
=
createSubpackageApp
;(
wx
as
any
).
createPluginApp
=
(
global
as
any
).
createPluginApp
=
createPluginApp
;(
wx
as
any
).
createSubpackageApp
=
(
global
as
any
).
createSubpackageApp
=
createSubpackageApp
}
packages/uni-quickapp-webview/src/runtime/index.ts
浏览文件 @
44ddf729
...
...
@@ -19,4 +19,5 @@ export const createSubpackageApp = initCreateSubpackageApp()
;(
qa
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
qa
as
any
).
createPage
=
createPage
;(
qa
as
any
).
createComponent
=
createComponent
;(
qa
as
any
).
createSubpackageApp
=
createSubpackageApp
;(
qa
as
any
).
createSubpackageApp
=
(
global
as
any
).
createSubpackageApp
=
createSubpackageApp
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录