Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wzj-java
uni-app
提交
6924630d
U
uni-app
项目概览
wzj-java
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6924630d
编写于
2月 02, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(mp): add createSubpackageApp
上级
4510acbc
变更
15
展开全部
隐藏空白更改
内联
并排
Showing
15 changed file
with
555 addition
and
315 deletion
+555
-315
packages/uni-app-plus/dist/index.js
packages/uni-app-plus/dist/index.js
+124
-98
packages/uni-mp-alipay/dist/index.js
packages/uni-mp-alipay/dist/index.js
+50
-25
packages/uni-mp-baidu/dist/index.js
packages/uni-mp-baidu/dist/index.js
+54
-28
packages/uni-mp-kuaishou/dist/index.js
packages/uni-mp-kuaishou/dist/index.js
+50
-25
packages/uni-mp-qq/dist/index.js
packages/uni-mp-qq/dist/index.js
+50
-25
packages/uni-mp-toutiao/dist/index.js
packages/uni-mp-toutiao/dist/index.js
+50
-25
packages/uni-mp-weixin/dist/index.js
packages/uni-mp-weixin/dist/index.js
+63
-38
packages/uni-quickapp-native/dist/vue.dev.js
packages/uni-quickapp-native/dist/vue.dev.js
+1
-1
packages/uni-quickapp-native/dist/vue.prod.js
packages/uni-quickapp-native/dist/vue.prod.js
+1
-1
packages/uni-quickapp-webview/dist/index.js
packages/uni-quickapp-webview/dist/index.js
+43
-17
packages/vue-cli-plugin-uni/lib/mp/index.js
packages/vue-cli-plugin-uni/lib/mp/index.js
+5
-1
src/core/runtime/index.js
src/core/runtime/index.js
+5
-2
src/core/runtime/wrapper/create-app.js
src/core/runtime/wrapper/create-app.js
+1
-27
src/core/runtime/wrapper/create-subpackage-app.js
src/core/runtime/wrapper/create-subpackage-app.js
+28
-0
src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js
src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js
+30
-2
未找到文件。
packages/uni-app-plus/dist/index.js
浏览文件 @
6924630d
...
...
@@ -639,74 +639,6 @@ if (!MPPage.__$wrappered) {
};
}
class
EventChannel
{
constructor
(
id
,
events
)
{
this
.
id
=
id
;
this
.
listener
=
{};
this
.
emitCache
=
{};
if
(
events
)
{
Object
.
keys
(
events
).
forEach
(
name
=>
{
this
.
on
(
name
,
events
[
name
]);
});
}
}
emit
(
eventName
,
...
args
)
{
const
fns
=
this
.
listener
[
eventName
];
if
(
!
fns
)
{
return
(
this
.
emitCache
[
eventName
]
||
(
this
.
emitCache
[
eventName
]
=
[])).
push
(
args
)
}
fns
.
forEach
(
opt
=>
{
opt
.
fn
.
apply
(
opt
.
fn
,
args
);
});
this
.
listener
[
eventName
]
=
fns
.
filter
(
opt
=>
opt
.
type
!==
'
once
'
);
}
on
(
eventName
,
fn
)
{
this
.
_addListener
(
eventName
,
'
on
'
,
fn
);
this
.
_clearCache
(
eventName
);
}
once
(
eventName
,
fn
)
{
this
.
_addListener
(
eventName
,
'
once
'
,
fn
);
this
.
_clearCache
(
eventName
);
}
off
(
eventName
,
fn
)
{
const
fns
=
this
.
listener
[
eventName
];
if
(
!
fns
)
{
return
}
if
(
fn
)
{
for
(
let
i
=
0
;
i
<
fns
.
length
;)
{
if
(
fns
[
i
].
fn
===
fn
)
{
fns
.
splice
(
i
,
1
);
i
--
;
}
i
++
;
}
}
else
{
delete
this
.
listener
[
eventName
];
}
}
_clearCache
(
eventName
)
{
const
cacheArgs
=
this
.
emitCache
[
eventName
];
if
(
cacheArgs
)
{
for
(;
cacheArgs
.
length
>
0
;)
{
this
.
emit
.
apply
(
this
,
[
eventName
].
concat
(
cacheArgs
.
shift
()));
}
}
}
_addListener
(
eventName
,
type
,
fn
)
{
(
this
.
listener
[
eventName
]
||
(
this
.
listener
[
eventName
]
=
[])).
push
({
fn
,
type
});
}
}
const
PAGE_EVENT_HOOKS
=
[
'
onPullDownRefresh
'
,
'
onReachBottom
'
,
...
...
@@ -1245,19 +1177,118 @@ function handleEvent (event) {
}
}
class
EventChannel
{
constructor
(
id
,
events
)
{
this
.
id
=
id
;
this
.
listener
=
{};
this
.
emitCache
=
{};
if
(
events
)
{
Object
.
keys
(
events
).
forEach
(
name
=>
{
this
.
on
(
name
,
events
[
name
]);
});
}
}
emit
(
eventName
,
...
args
)
{
const
fns
=
this
.
listener
[
eventName
];
if
(
!
fns
)
{
return
(
this
.
emitCache
[
eventName
]
||
(
this
.
emitCache
[
eventName
]
=
[])).
push
(
args
)
}
fns
.
forEach
(
opt
=>
{
opt
.
fn
.
apply
(
opt
.
fn
,
args
);
});
this
.
listener
[
eventName
]
=
fns
.
filter
(
opt
=>
opt
.
type
!==
'
once
'
);
}
on
(
eventName
,
fn
)
{
this
.
_addListener
(
eventName
,
'
on
'
,
fn
);
this
.
_clearCache
(
eventName
);
}
once
(
eventName
,
fn
)
{
this
.
_addListener
(
eventName
,
'
once
'
,
fn
);
this
.
_clearCache
(
eventName
);
}
off
(
eventName
,
fn
)
{
const
fns
=
this
.
listener
[
eventName
];
if
(
!
fns
)
{
return
}
if
(
fn
)
{
for
(
let
i
=
0
;
i
<
fns
.
length
;)
{
if
(
fns
[
i
].
fn
===
fn
)
{
fns
.
splice
(
i
,
1
);
i
--
;
}
i
++
;
}
}
else
{
delete
this
.
listener
[
eventName
];
}
}
_clearCache
(
eventName
)
{
const
cacheArgs
=
this
.
emitCache
[
eventName
];
if
(
cacheArgs
)
{
for
(;
cacheArgs
.
length
>
0
;)
{
this
.
emit
.
apply
(
this
,
[
eventName
].
concat
(
cacheArgs
.
shift
()));
}
}
}
_addListener
(
eventName
,
type
,
fn
)
{
(
this
.
listener
[
eventName
]
||
(
this
.
listener
[
eventName
]
=
[])).
push
({
fn
,
type
});
}
}
const
eventChannels
=
{};
const
eventChannelStack
=
[];
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
}
return
eventChannelStack
.
shift
()
}
const
hooks
=
[
'
onShow
'
,
'
onHide
'
,
'
onError
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onUnhandledRejection
'
];
function
initEventChannel
()
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
();
}
return
this
.
__eventChannel__
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
}
function
parseBaseApp
(
vm
,
{
mocks
,
initRefs
})
{
initEventChannel
();
if
(
vm
.
$options
.
store
)
{
Vue
.
prototype
.
$store
=
vm
.
$options
.
store
;
}
...
...
@@ -1426,34 +1457,7 @@ function parseApp$1 (vm) {
return
appOptions
}
const
eventChannels
=
{};
const
eventChannelStack
=
[];
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
}
return
eventChannelStack
.
shift
()
}
function
createApp
(
vm
)
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
();
}
return
this
.
__eventChannel__
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
App
(
parseApp$1
(
vm
));
return
vm
}
...
...
@@ -1675,6 +1679,27 @@ function createComponent (vueOptions) {
}
}
function
createSubpackageApp
(
vm
)
{
const
appOptions
=
parseApp$1
(
vm
);
const
app
=
getApp
({
allowDefault
:
true
});
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
return
vm
}
todos
.
forEach
(
todoApi
=>
{
protocols
[
todoApi
]
=
false
;
});
...
...
@@ -1744,8 +1769,9 @@ if (typeof Proxy !== 'undefined' && "app-plus" !== 'app-plus') {
wx
.
createApp
=
createApp
;
wx
.
createPage
=
createPage
;
wx
.
createComponent
=
createComponent
;
wx
.
createSubpackageApp
=
createSubpackageApp
;
var
uni$1
=
uni
;
export
default
uni$1
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/uni-mp-alipay/dist/index.js
浏览文件 @
6924630d
import
{
v4
}
from
'
uuid
'
;
import
Vue
from
'
vue
'
;
const
_toString
=
Object
.
prototype
.
toString
;
...
...
@@ -513,18 +512,18 @@ function removeStorageSync (key) {
})
}
const
UUID_KEY
=
'
__DC_UUID
'
;
let
uui
d
;
const
UUID_KEY
=
'
__DC_
STAT_
UUID
'
;
let
deviceI
d
;
function
addUuid
(
result
)
{
uuid
=
uui
d
||
getStorageSync
(
UUID_KEY
);
if
(
!
uui
d
)
{
uuid
=
v4
(
);
deviceId
=
deviceI
d
||
getStorageSync
(
UUID_KEY
);
if
(
!
deviceI
d
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
);
my
.
setStorage
({
key
:
UUID_KEY
,
data
:
uui
d
data
:
deviceI
d
});
}
result
.
uuid
=
uui
d
;
result
.
deviceId
=
deviceI
d
;
}
function
addSafeAreaInsets
(
result
)
{
...
...
@@ -1905,15 +1904,33 @@ const hooks = [
'
onShow
'
,
'
onHide
'
,
'
onError
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onUnhandledRejection
'
];
function
initEventChannel$1
()
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
();
}
return
this
.
__eventChannel__
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
}
function
parseBaseApp
(
vm
,
{
mocks
,
initRefs
})
{
initEventChannel$1
();
if
(
vm
.
$options
.
store
)
{
Vue
.
prototype
.
$store
=
vm
.
$options
.
store
;
}
...
...
@@ -2317,20 +2334,6 @@ function parseApp (vm) {
}
function
createApp
(
vm
)
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
();
}
return
this
.
__eventChannel__
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
App
(
parseApp
(
vm
));
return
vm
}
...
...
@@ -2589,6 +2592,27 @@ function createComponent (vueOptions) {
}
}
function
createSubpackageApp
(
vm
)
{
const
appOptions
=
parseApp
(
vm
);
const
app
=
getApp
({
allowDefault
:
true
});
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
return
vm
}
todos
.
forEach
(
todoApi
=>
{
protocols
[
todoApi
]
=
false
;
});
...
...
@@ -2668,8 +2692,9 @@ if (typeof Proxy !== 'undefined' && "mp-alipay" !== 'app-plus') {
my
.
createApp
=
createApp
;
my
.
createPage
=
createPage
;
my
.
createComponent
=
createComponent
;
my
.
createSubpackageApp
=
createSubpackageApp
;
var
uni$1
=
uni
;
export
default
uni$1
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/uni-mp-baidu/dist/index.js
浏览文件 @
6924630d
import
{
v4
}
from
'
uuid
'
;
import
Vue
from
'
vue
'
;
const
_toString
=
Object
.
prototype
.
toString
;
...
...
@@ -528,18 +527,18 @@ var previewImage = {
}
};
const
UUID_KEY
=
'
__DC_UUID
'
;
let
uui
d
;
const
UUID_KEY
=
'
__DC_
STAT_
UUID
'
;
let
deviceI
d
;
function
addUuid
(
result
)
{
uuid
=
uui
d
||
swan
.
getStorageSync
(
UUID_KEY
);
if
(
!
uui
d
)
{
uuid
=
v4
(
);
deviceId
=
deviceI
d
||
swan
.
getStorageSync
(
UUID_KEY
);
if
(
!
deviceI
d
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
);
swan
.
setStorage
({
key
:
UUID_KEY
,
data
:
uui
d
data
:
deviceI
d
});
}
result
.
uuid
=
uui
d
;
result
.
deviceId
=
deviceI
d
;
}
function
addSafeAreaInsets
(
result
)
{
...
...
@@ -1594,15 +1593,33 @@ const hooks = [
'
onShow
'
,
'
onHide
'
,
'
onError
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onUnhandledRejection
'
];
function
initEventChannel$1
()
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
();
}
return
this
.
__eventChannel__
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
}
function
parseBaseApp
(
vm
,
{
mocks
,
initRefs
})
{
initEventChannel$1
();
if
(
vm
.
$options
.
store
)
{
Vue
.
prototype
.
$store
=
vm
.
$options
.
store
;
}
...
...
@@ -1770,20 +1787,6 @@ function parseApp (vm) {
}
function
createApp
(
vm
)
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
();
}
return
this
.
__eventChannel__
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
App
(
parseApp
(
vm
));
return
vm
}
...
...
@@ -1934,16 +1937,17 @@ function parseComponent (vueOptions) {
// 关于百度小程序生命周期的说明(组件作为页面时):
// lifetimes:attached --> methods:onShow --> methods:onLoad --> methods:onReady
// 这里在强制将onShow挪到onLoad之后触发,另外一处修改在page-parser.js
le
t
oldAttached
=
componentOptions
.
lifetimes
.
attached
;
cons
t
oldAttached
=
componentOptions
.
lifetimes
.
attached
;
// 百度小程序基础库 3.260 以上支持页面 onInit 生命周期,提前创建 vm 实例
componentOptions
.
lifetimes
.
onInit
=
function
onInit
(
query
)
{
oldAttached
.
call
(
this
);
oldAttached
=
noop
;
this
.
pageinstance
.
$vm
=
this
.
$vm
;
this
.
$vm
.
__call_hook
(
'
onInit
'
,
query
);
};
componentOptions
.
lifetimes
.
attached
=
function
attached
()
{
oldAttached
.
call
(
this
);
if
(
!
this
.
$vm
)
{
oldAttached
.
call
(
this
);
}
if
(
isPage
.
call
(
this
))
{
// 百度 onLoad 在 attached 之前触发(基础库小于 3.70)
// 百度 当组件作为页面时 pageinstancce 不是原来组件的 instance
this
.
pageinstance
.
$vm
=
this
.
$vm
;
...
...
@@ -2074,6 +2078,27 @@ function createComponent (vueOptions) {
}
}
function
createSubpackageApp
(
vm
)
{
const
appOptions
=
parseApp
(
vm
);
const
app
=
getApp
({
allowDefault
:
true
});
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
return
vm
}
todos
.
forEach
(
todoApi
=>
{
protocols
[
todoApi
]
=
false
;
});
...
...
@@ -2153,8 +2178,9 @@ if (typeof Proxy !== 'undefined' && "mp-baidu" !== 'app-plus') {
swan
.
createApp
=
createApp
;
swan
.
createPage
=
createPage
;
swan
.
createComponent
=
createComponent
;
swan
.
createSubpackageApp
=
createSubpackageApp
;
var
uni$1
=
uni
;
export
default
uni$1
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/uni-mp-kuaishou/dist/index.js
浏览文件 @
6924630d
import
{
v4
}
from
'
uuid
'
;
import
Vue
from
'
vue
'
;
const
_toString
=
Object
.
prototype
.
toString
;
...
...
@@ -528,18 +527,18 @@ var previewImage = {
}
};
const
UUID_KEY
=
'
__DC_UUID
'
;
let
uui
d
;
const
UUID_KEY
=
'
__DC_
STAT_
UUID
'
;
let
deviceI
d
;
function
addUuid
(
result
)
{
uuid
=
uui
d
||
ks
.
getStorageSync
(
UUID_KEY
);
if
(
!
uui
d
)
{
uuid
=
v4
(
);
deviceId
=
deviceI
d
||
ks
.
getStorageSync
(
UUID_KEY
);
if
(
!
deviceI
d
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
);
ks
.
setStorage
({
key
:
UUID_KEY
,
data
:
uui
d
data
:
deviceI
d
});
}
result
.
uuid
=
uui
d
;
result
.
deviceId
=
deviceI
d
;
}
function
addSafeAreaInsets
(
result
)
{
...
...
@@ -1346,15 +1345,33 @@ const hooks = [
'
onShow
'
,
'
onHide
'
,
'
onError
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onUnhandledRejection
'
];
function
initEventChannel$1
()
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
();
}
return
this
.
__eventChannel__
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
}
function
parseBaseApp
(
vm
,
{
mocks
,
initRefs
})
{
initEventChannel$1
();
if
(
vm
.
$options
.
store
)
{
Vue
.
prototype
.
$store
=
vm
.
$options
.
store
;
}
...
...
@@ -1516,20 +1533,6 @@ function parseApp$1 (vm) {
}
function
createApp
(
vm
)
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
();
}
return
this
.
__eventChannel__
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
App
(
parseApp$1
(
vm
));
return
vm
}
...
...
@@ -1733,6 +1736,27 @@ function createComponent (vueOptions) {
}
}
function
createSubpackageApp
(
vm
)
{
const
appOptions
=
parseApp$1
(
vm
);
const
app
=
getApp
({
allowDefault
:
true
});
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
return
vm
}
todos
.
forEach
(
todoApi
=>
{
protocols
[
todoApi
]
=
false
;
});
...
...
@@ -1812,8 +1836,9 @@ if (typeof Proxy !== 'undefined' && "mp-kuaishou" !== 'app-plus') {
ks
.
createApp
=
createApp
;
ks
.
createPage
=
createPage
;
ks
.
createComponent
=
createComponent
;
ks
.
createSubpackageApp
=
createSubpackageApp
;
var
uni$1
=
uni
;
export
default
uni$1
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/uni-mp-qq/dist/index.js
浏览文件 @
6924630d
import
{
v4
}
from
'
uuid
'
;
import
Vue
from
'
vue
'
;
const
_toString
=
Object
.
prototype
.
toString
;
...
...
@@ -528,18 +527,18 @@ var previewImage = {
}
};
const
UUID_KEY
=
'
__DC_UUID
'
;
let
uui
d
;
const
UUID_KEY
=
'
__DC_
STAT_
UUID
'
;
let
deviceI
d
;
function
addUuid
(
result
)
{
uuid
=
uui
d
||
wx
.
getStorageSync
(
UUID_KEY
);
if
(
!
uui
d
)
{
uuid
=
v4
(
);
deviceId
=
deviceI
d
||
wx
.
getStorageSync
(
UUID_KEY
);
if
(
!
deviceI
d
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
);
wx
.
setStorage
({
key
:
UUID_KEY
,
data
:
uui
d
data
:
deviceI
d
});
}
result
.
uuid
=
uui
d
;
result
.
deviceId
=
deviceI
d
;
}
function
addSafeAreaInsets
(
result
)
{
...
...
@@ -1507,15 +1506,33 @@ const hooks = [
'
onShow
'
,
'
onHide
'
,
'
onError
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onUnhandledRejection
'
];
function
initEventChannel$1
()
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
();
}
return
this
.
__eventChannel__
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
}
function
parseBaseApp
(
vm
,
{
mocks
,
initRefs
})
{
initEventChannel$1
();
if
(
vm
.
$options
.
store
)
{
Vue
.
prototype
.
$store
=
vm
.
$options
.
store
;
}
...
...
@@ -1682,20 +1699,6 @@ function parseApp$1 (vm) {
}
function
createApp
(
vm
)
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
();
}
return
this
.
__eventChannel__
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
App
(
parseApp$1
(
vm
));
return
vm
}
...
...
@@ -1906,6 +1909,27 @@ function createComponent (vueOptions) {
}
}
function
createSubpackageApp
(
vm
)
{
const
appOptions
=
parseApp$1
(
vm
);
const
app
=
getApp
({
allowDefault
:
true
});
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
return
vm
}
todos
.
forEach
(
todoApi
=>
{
protocols
[
todoApi
]
=
false
;
});
...
...
@@ -1985,8 +2009,9 @@ if (typeof Proxy !== 'undefined' && "mp-qq" !== 'app-plus') {
wx
.
createApp
=
createApp
;
wx
.
createPage
=
createPage
;
wx
.
createComponent
=
createComponent
;
wx
.
createSubpackageApp
=
createSubpackageApp
;
var
uni$1
=
uni
;
export
default
uni$1
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/uni-mp-toutiao/dist/index.js
浏览文件 @
6924630d
import
{
v4
}
from
'
uuid
'
;
import
Vue
from
'
vue
'
;
const
_toString
=
Object
.
prototype
.
toString
;
...
...
@@ -528,18 +527,18 @@ var previewImage = {
}
};
const
UUID_KEY
=
'
__DC_UUID
'
;
let
uui
d
;
const
UUID_KEY
=
'
__DC_
STAT_
UUID
'
;
let
deviceI
d
;
function
addUuid
(
result
)
{
uuid
=
uui
d
||
tt
.
getStorageSync
(
UUID_KEY
);
if
(
!
uui
d
)
{
uuid
=
v4
(
);
deviceId
=
deviceI
d
||
tt
.
getStorageSync
(
UUID_KEY
);
if
(
!
deviceI
d
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
);
tt
.
setStorage
({
key
:
UUID_KEY
,
data
:
uui
d
data
:
deviceI
d
});
}
result
.
uuid
=
uui
d
;
result
.
deviceId
=
deviceI
d
;
}
function
addSafeAreaInsets
(
result
)
{
...
...
@@ -1599,15 +1598,33 @@ const hooks = [
'
onShow
'
,
'
onHide
'
,
'
onError
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onUnhandledRejection
'
];
function
initEventChannel$1
()
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
();
}
return
this
.
__eventChannel__
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
}
function
parseBaseApp
(
vm
,
{
mocks
,
initRefs
})
{
initEventChannel$1
();
if
(
vm
.
$options
.
store
)
{
Vue
.
prototype
.
$store
=
vm
.
$options
.
store
;
}
...
...
@@ -1849,20 +1866,6 @@ function parseApp (vm) {
}
function
createApp
(
vm
)
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
();
}
return
this
.
__eventChannel__
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
App
(
parseApp
(
vm
));
return
vm
}
...
...
@@ -2114,6 +2117,27 @@ function createComponent (vueOptions) {
}
}
function
createSubpackageApp
(
vm
)
{
const
appOptions
=
parseApp
(
vm
);
const
app
=
getApp
({
allowDefault
:
true
});
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
return
vm
}
todos
.
forEach
(
todoApi
=>
{
protocols
[
todoApi
]
=
false
;
});
...
...
@@ -2193,8 +2217,9 @@ if (typeof Proxy !== 'undefined' && "mp-toutiao" !== 'app-plus') {
tt
.
createApp
=
createApp
;
tt
.
createPage
=
createPage
;
tt
.
createComponent
=
createComponent
;
tt
.
createSubpackageApp
=
createSubpackageApp
;
var
uni$1
=
uni
;
export
default
uni$1
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/uni-mp-weixin/dist/index.js
浏览文件 @
6924630d
import
{
v4
}
from
'
uuid
'
;
import
Vue
from
'
vue
'
;
const
_toString
=
Object
.
prototype
.
toString
;
...
...
@@ -423,18 +422,18 @@ var previewImage = {
}
};
const
UUID_KEY
=
'
__DC_UUID
'
;
let
uui
d
;
const
UUID_KEY
=
'
__DC_
STAT_
UUID
'
;
let
deviceI
d
;
function
addUuid
(
result
)
{
uuid
=
uui
d
||
wx
.
getStorageSync
(
UUID_KEY
);
if
(
!
uui
d
)
{
uuid
=
v4
(
);
deviceId
=
deviceI
d
||
wx
.
getStorageSync
(
UUID_KEY
);
if
(
!
deviceI
d
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
);
wx
.
setStorage
({
key
:
UUID_KEY
,
data
:
uui
d
data
:
deviceI
d
});
}
result
.
uuid
=
uui
d
;
result
.
deviceId
=
deviceI
d
;
}
function
addSafeAreaInsets
(
result
)
{
...
...
@@ -1247,19 +1246,50 @@ function handleEvent (event) {
}
}
const
eventChannels
=
{};
const
eventChannelStack
=
[];
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
}
return
eventChannelStack
.
shift
()
}
const
hooks
=
[
'
onShow
'
,
'
onHide
'
,
'
onError
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onUnhandledRejection
'
];
function
initEventChannel
()
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
// 微信小程序使用自身getOpenerEventChannel
{
return
this
.
$scope
.
getOpenerEventChannel
()
}
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
}
function
parseBaseApp
(
vm
,
{
mocks
,
initRefs
})
{
initEventChannel
();
if
(
vm
.
$options
.
store
)
{
Vue
.
prototype
.
$store
=
vm
.
$options
.
store
;
}
...
...
@@ -1428,34 +1458,7 @@ function parseApp (vm) {
})
}
const
eventChannels
=
{};
const
eventChannelStack
=
[];
function
getEventChannel
(
id
)
{
if
(
id
)
{
const
eventChannel
=
eventChannels
[
id
];
delete
eventChannels
[
id
];
return
eventChannel
}
return
eventChannelStack
.
shift
()
}
function
createApp
(
vm
)
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
// 微信小程序使用自身getOpenerEventChannel
{
return
this
.
$scope
.
getOpenerEventChannel
()
}
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
App
(
parseApp
(
vm
));
return
vm
}
...
...
@@ -1658,6 +1661,27 @@ function createComponent (vueOptions) {
}
}
function
createSubpackageApp
(
vm
)
{
const
appOptions
=
parseApp
(
vm
);
const
app
=
getApp
({
allowDefault
:
true
});
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
return
vm
}
todos
.
forEach
(
todoApi
=>
{
protocols
[
todoApi
]
=
false
;
});
...
...
@@ -1737,8 +1761,9 @@ if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
wx
.
createApp
=
createApp
;
wx
.
createPage
=
createPage
;
wx
.
createComponent
=
createComponent
;
wx
.
createSubpackageApp
=
createSubpackageApp
;
var
uni$1
=
uni
;
export
default
uni$1
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/uni-quickapp-native/dist/vue.dev.js
浏览文件 @
6924630d
此差异已折叠。
点击以展开。
packages/uni-quickapp-native/dist/vue.prod.js
浏览文件 @
6924630d
此差异已折叠。
点击以展开。
packages/uni-quickapp-webview/dist/index.js
浏览文件 @
6924630d
...
...
@@ -1320,15 +1320,33 @@ const hooks = [
'
onShow
'
,
'
onHide
'
,
'
onError
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onUnhandledRejection
'
];
function
initEventChannel$1
()
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
();
}
return
this
.
__eventChannel__
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
}
function
parseBaseApp
(
vm
,
{
mocks
,
initRefs
})
{
initEventChannel$1
();
if
(
vm
.
$options
.
store
)
{
Vue
.
prototype
.
$store
=
vm
.
$options
.
store
;
}
...
...
@@ -1558,20 +1576,6 @@ function parseApp (vm) {
}
function
createApp
(
vm
)
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
();
}
return
this
.
__eventChannel__
};
const
callHook
=
Vue
.
prototype
.
__call_hook
;
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
);
delete
args
.
__id__
;
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
App
(
parseApp
(
vm
));
return
vm
}
...
...
@@ -1823,6 +1827,27 @@ function createComponent (vueOptions) {
}
}
function
createSubpackageApp
(
vm
)
{
const
appOptions
=
parseApp
(
vm
);
const
app
=
getApp
({
allowDefault
:
true
});
const
globalData
=
app
.
globalData
;
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
];
}
});
}
Object
.
keys
(
appOptions
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
];
}
});
return
vm
}
todos
.
forEach
(
todoApi
=>
{
protocols
[
todoApi
]
=
false
;
});
...
...
@@ -1902,8 +1927,9 @@ if (typeof Proxy !== 'undefined' && "quickapp-webview" !== 'app-plus') {
qa
.
createApp
=
createApp
;
qa
.
createPage
=
createPage
;
qa
.
createComponent
=
createComponent
;
qa
.
createSubpackageApp
=
createSubpackageApp
;
var
uni$1
=
uni
;
export
default
uni$1
;
export
{
createApp
,
createComponent
,
createPage
};
export
{
createApp
,
createComponent
,
createPage
,
createSubpackageApp
};
packages/vue-cli-plugin-uni/lib/mp/index.js
浏览文件 @
6924630d
...
...
@@ -36,7 +36,11 @@ function getProvides () {
}
if
(
process
.
env
.
UNI_USING_COMPONENTS
)
{
provides
.
createApp
=
[
uniPath
,
'
createApp
'
]
if
(
process
.
env
.
UNI_SUBPACKGE
)
{
provides
.
createApp
=
[
uniPath
,
'
createSubpackageApp
'
]
}
else
{
provides
.
createApp
=
[
uniPath
,
'
createApp
'
]
}
provides
.
createPage
=
[
uniPath
,
'
createPage
'
]
provides
.
createComponent
=
[
uniPath
,
'
createComponent
'
]
}
...
...
src/core/runtime/index.js
浏览文件 @
6924630d
...
...
@@ -26,7 +26,8 @@ import {
import
createApp
from
'
./wrapper/create-app
'
import
createPage
from
'
./wrapper/create-page
'
import
createComponent
from
'
./wrapper/create-component
'
import
createComponent
from
'
./wrapper/create-component
'
import
createSubpackageApp
from
'
./wrapper/create-subpackage-app
'
todos
.
forEach
(
todoApi
=>
{
protocols
[
todoApi
]
=
false
...
...
@@ -114,11 +115,13 @@ if (__PLATFORM__ === 'app-plus') {
__GLOBAL__
.
createApp
=
createApp
__GLOBAL__
.
createPage
=
createPage
__GLOBAL__
.
createComponent
=
createComponent
__GLOBAL__
.
createSubpackageApp
=
createSubpackageApp
export
{
createApp
,
createPage
,
createComponent
createComponent
,
createSubpackageApp
}
export
default
uni
src/core/runtime/wrapper/create-app.js
浏览文件 @
6924630d
import
Vue
from
'
vue
'
import
'
uni-platform/runtime/index
'
import
EventChannel
from
'
uni-helpers/EventChannel
'
import
parseApp
from
'
uni-platform/runtime/wrapper/app-parser
'
import
{
getEventChannel
}
from
'
uni-helpers/navigate-to
'
export
default
function
createApp
(
vm
)
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
// 微信小程序使用自身getOpenerEventChannel
if
(
__PLATFORM__
===
'
mp-weixin
'
)
{
return
this
.
$scope
.
getOpenerEventChannel
()
}
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
()
}
return
this
.
__eventChannel__
}
const
callHook
=
Vue
.
prototype
.
__call_hook
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
)
delete
args
.
__id__
}
return
callHook
.
call
(
this
,
hook
,
args
)
}
App
(
parseApp
(
vm
))
return
vm
}
}
src/core/runtime/wrapper/create-subpackage-app.js
0 → 100644
浏览文件 @
6924630d
import
'
uni-platform/runtime/index
'
import
{
hasOwn
}
from
'
uni-shared
'
import
parseApp
from
'
uni-platform/runtime/wrapper/app-parser
'
export
default
function
createSubpackageApp
(
vm
)
{
const
appOptions
=
parseApp
(
vm
)
const
app
=
getApp
({
allowDefault
:
true
})
const
globalData
=
app
.
globalData
if
(
globalData
)
{
Object
.
keys
(
appOptions
.
globalData
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
globalData
,
name
))
{
globalData
[
name
]
=
appOptions
.
globalData
[
name
]
}
})
}
Object
.
keys
(
appOptions
).
forEach
(
name
=>
{
if
(
!
hasOwn
(
app
,
name
))
{
app
[
name
]
=
appOptions
[
name
]
}
})
return
vm
}
src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js
浏览文件 @
6924630d
...
...
@@ -5,19 +5,47 @@ import {
initMocks
}
from
'
uni-wrapper/util
'
import
EventChannel
from
'
uni-helpers/EventChannel
'
import
{
getEventChannel
}
from
'
uni-helpers/navigate-to
'
const
hooks
=
[
'
onShow
'
,
'
onHide
'
,
'
onError
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onUnhandledRejection
'
]
function
initEventChannel
()
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
// 微信小程序使用自身getOpenerEventChannel
if
(
__PLATFORM__
===
'
mp-weixin
'
)
{
return
this
.
$scope
.
getOpenerEventChannel
()
}
if
(
!
this
.
__eventChannel__
)
{
this
.
__eventChannel__
=
new
EventChannel
()
}
return
this
.
__eventChannel__
}
const
callHook
=
Vue
.
prototype
.
__call_hook
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
)
delete
args
.
__id__
}
return
callHook
.
call
(
this
,
hook
,
args
)
}
}
export
default
function
parseBaseApp
(
vm
,
{
mocks
,
initRefs
})
{
initEventChannel
()
if
(
vm
.
$options
.
store
)
{
Vue
.
prototype
.
$store
=
vm
.
$options
.
store
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录