Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
m0_68066342
uni-app
提交
7325d4b3
U
uni-app
项目概览
m0_68066342
/
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,发现更多精彩内容 >>
提交
7325d4b3
编写于
9月 19, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(mp): vue@3.0.0
上级
6d85aa0c
变更
17
展开全部
显示空白变更内容
内联
并排
Showing
17 changed file
with
1320 addition
and
626 deletion
+1320
-626
packages/uni-mp-alipay/dist/uni.api.esm.js
packages/uni-mp-alipay/dist/uni.api.esm.js
+59
-8
packages/uni-mp-alipay/dist/uni.mp.esm.js
packages/uni-mp-alipay/dist/uni.mp.esm.js
+42
-36
packages/uni-mp-baidu/dist/index.js
packages/uni-mp-baidu/dist/index.js
+5
-0
packages/uni-mp-baidu/dist/uni.api.esm.js
packages/uni-mp-baidu/dist/uni.api.esm.js
+59
-8
packages/uni-mp-baidu/dist/uni.mp.esm.js
packages/uni-mp-baidu/dist/uni.mp.esm.js
+32
-35
packages/uni-mp-kuaishou/dist/index.js
packages/uni-mp-kuaishou/dist/index.js
+85
-15
packages/uni-mp-qq/dist/uni.api.esm.js
packages/uni-mp-qq/dist/uni.api.esm.js
+59
-8
packages/uni-mp-qq/dist/uni.mp.esm.js
packages/uni-mp-qq/dist/uni.mp.esm.js
+31
-34
packages/uni-mp-toutiao/dist/uni.api.esm.js
packages/uni-mp-toutiao/dist/uni.api.esm.js
+58
-7
packages/uni-mp-toutiao/dist/uni.mp.esm.js
packages/uni-mp-toutiao/dist/uni.mp.esm.js
+31
-34
packages/uni-mp-vue/dist/vue.runtime.esm.js
packages/uni-mp-vue/dist/vue.runtime.esm.js
+672
-355
packages/uni-mp-weixin/dist/uni.api.esm.js
packages/uni-mp-weixin/dist/uni.api.esm.js
+59
-8
packages/uni-mp-weixin/dist/uni.mp.esm.js
packages/uni-mp-weixin/dist/uni.mp.esm.js
+31
-34
packages/uni-quickapp-webview/dist/uni.api.esm.js
packages/uni-quickapp-webview/dist/uni.api.esm.js
+59
-8
packages/uni-quickapp-webview/dist/uni.mp.esm.js
packages/uni-quickapp-webview/dist/uni.mp.esm.js
+32
-35
packages/vue-cli-plugin-uni/generator.js
packages/vue-cli-plugin-uni/generator.js
+1
-1
src/platforms/mp-baidu/runtime/wrapper/page-parser.js
src/platforms/mp-baidu/runtime/wrapper/page-parser.js
+5
-0
未找到文件。
packages/uni-mp-alipay/dist/uni.api.esm.js
浏览文件 @
7325d4b3
import
{
isArray
,
isPromise
,
isFunction
,
isPlainObject
,
hasOwn
,
isString
}
from
'
@vue/shared
'
;
const
API_TYPE_SYNC
=
1
;
function
validateProtocol
(
_name
,
_args
,
_protocol
)
{
return
true
;
}
function
formatApiArgs
(
args
,
options
)
{
if
(
!
options
)
{
return
args
;
}
}
function
createApi
({
type
,
name
,
options
},
fn
,
protocol
)
{
return
function
(...
args
)
{
if
(
type
===
API_TYPE_SYNC
)
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
()))
{
return
fn
.
apply
(
null
,
formatApiArgs
(
args
,
options
));
}
}
};
}
const
Upx2pxProtocol
=
[
{
name
:
'
upx
'
,
type
:
[
Number
,
String
],
required
:
true
}
];
const
EPS
=
1
e
-
4
;
const
BASE_DEVICE_WIDTH
=
750
;
let
isIOS
=
false
;
...
...
@@ -11,7 +38,7 @@ function checkDeviceWidth() {
deviceDPR
=
pixelRatio
;
isIOS
=
platform
===
'
ios
'
;
}
function
upx2px
(
number
,
newDeviceWidth
)
{
const
upx2px
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
upx2px
'
},
(
number
,
newDeviceWidth
)
=>
{
if
(
deviceWidth
===
0
)
{
checkDeviceWidth
();
}
...
...
@@ -33,7 +60,7 @@ function upx2px(number, newDeviceWidth) {
}
}
return
number
<
0
?
-
result
:
result
;
}
}
,
Upx2pxProtocol
);
var
HOOKS
;
(
function
(
HOOKS
)
{
...
...
@@ -139,6 +166,15 @@ function invokeApi(method, api, options, ...params) {
return
api
(
options
,
...
params
);
}
const
AddInterceptorProtocol
=
[
{
name
:
'
method
'
,
type
:
[
String
,
Object
],
required
:
true
}
];
const
RemoveInterceptorProtocol
=
AddInterceptorProtocol
;
function
mergeInterceptorHook
(
interceptors
,
interceptor
)
{
Object
.
keys
(
interceptor
).
forEach
(
hook
=>
{
if
(
isFunction
(
interceptor
[
hook
]))
{
...
...
@@ -184,15 +220,15 @@ function removeHook(hooks, hook) {
hooks
.
splice
(
index
,
1
);
}
}
function
addInterceptor
(
method
,
interceptor
)
{
const
addInterceptor
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
addInterceptor
'
},
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
&&
isPlainObject
(
interceptor
))
{
mergeInterceptorHook
(
scopedInterceptors
[
method
]
||
(
scopedInterceptors
[
method
]
=
{}),
interceptor
);
}
else
if
(
isPlainObject
(
method
))
{
mergeInterceptorHook
(
globalInterceptors
,
method
);
}
}
function
removeInterceptor
(
method
,
interceptor
)
{
}
,
AddInterceptorProtocol
);
const
removeInterceptor
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
removeInterceptor
'
},
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
)
{
if
(
isPlainObject
(
interceptor
))
{
removeInterceptorHook
(
scopedInterceptors
[
method
],
interceptor
);
...
...
@@ -204,7 +240,7 @@ function removeInterceptor(method, interceptor) {
else
if
(
isPlainObject
(
method
))
{
removeInterceptorHook
(
globalInterceptors
,
method
);
}
}
}
,
RemoveInterceptorProtocol
);
const
SYNC_API_RE
=
/^
\$
|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
...
...
@@ -414,6 +450,19 @@ function addSafeAreaInsets(fromRes, toRes) {
};
}
}
const
redirectTo
=
{};
const
createCanvasContext
=
{
returnValue
(
fromRes
,
toRes
)
{
const
measureText
=
fromRes
.
measureText
;
toRes
.
measureText
=
function
(
text
,
callback
)
{
const
textMetrics
=
measureText
.
call
(
this
,
text
);
if
(
typeof
callback
===
'
function
'
)
{
setTimeout
(()
=>
callback
(
textMetrics
),
0
);
}
return
textMetrics
;
};
}
};
const
getProvider
=
initGetProvider
({
oauth
:
[
'
alipay
'
],
...
...
@@ -1000,7 +1049,9 @@ var protocols = /*#__PURE__*/Object.freeze({
hideHomeButton
:
hideHomeButton
,
saveImageToPhotosAlbum
:
saveImageToPhotosAlbum
,
saveVideoToPhotosAlbum
:
saveVideoToPhotosAlbum
,
chooseAddress
:
chooseAddress
chooseAddress
:
chooseAddress
,
redirectTo
:
redirectTo
,
createCanvasContext
:
createCanvasContext
});
var
index
=
initUni
(
shims
,
protocols
);
...
...
packages/uni-mp-alipay/dist/uni.mp.esm.js
浏览文件 @
7325d4b3
...
...
@@ -52,28 +52,6 @@ const MP_METHODS = [
'
selectAllComponents
'
,
'
selectComponent
'
];
function
hasHook
(
name
)
{
const
hooks
=
this
.
$
[
name
];
if
(
hooks
&&
hooks
.
length
)
{
return
true
;
}
return
false
;
}
function
callHook
(
name
,
args
)
{
if
(
name
===
'
mounted
'
)
{
callHook
.
call
(
this
,
'
bm
'
);
// beforeMount
this
.
$
.
isMounted
=
true
;
name
=
'
m
'
;
}
const
hooks
=
this
.
$
[
name
];
let
ret
;
if
(
hooks
)
{
for
(
let
i
=
0
;
i
<
hooks
.
length
;
i
++
)
{
ret
=
hooks
[
i
](
args
);
}
}
return
ret
;
}
function
createEmitFn
(
oldEmit
,
ctx
)
{
return
function
emit
(
event
,
...
args
)
{
if
(
ctx
.
$scope
&&
event
)
{
...
...
@@ -89,9 +67,6 @@ function createEmitFn(oldEmit, ctx) {
return
oldEmit
.
apply
(
this
,
[
event
,
...
args
]);
};
}
function
set
(
target
,
key
,
val
)
{
return
(
target
[
key
]
=
val
);
}
function
initBaseInstance
(
instance
,
options
)
{
const
ctx
=
instance
.
ctx
;
// mp
...
...
@@ -100,7 +75,9 @@ function initBaseInstance(instance, options) {
ctx
.
$scope
=
options
.
mpInstance
;
// TODO @deprecated
ctx
.
$mp
=
{};
if
(
__VUE_OPTIONS_API__
)
{
ctx
.
_self
=
{};
}
// $vm
ctx
.
$scope
.
$vm
=
instance
.
proxy
;
// slots
...
...
@@ -111,15 +88,8 @@ function initBaseInstance(instance, options) {
}
});
}
if
(
__VUE_OPTIONS_API__
)
{
// $set
ctx
.
$set
=
set
;
}
// $emit
instance
.
emit
=
createEmitFn
(
instance
.
emit
,
ctx
);
// $callHook
ctx
.
$hasHook
=
hasHook
;
ctx
.
$callHook
=
callHook
;
}
function
initComponentInstance
(
instance
,
options
)
{
initBaseInstance
(
instance
,
options
);
...
...
@@ -216,7 +186,7 @@ function parseApp(instance, parseAppOptions) {
$vm
:
instance
,
onLaunch
(
options
)
{
const
ctx
=
internalInstance
.
ctx
;
if
(
this
.
$vm
&&
ctx
.
$
callHook
)
{
if
(
this
.
$vm
&&
ctx
.
$
scope
)
{
// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
return
;
}
...
...
@@ -247,6 +217,26 @@ function initCreateApp(parseAppOptions) {
};
}
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
const
res
=
obj
?
Object
.
keys
(
obj
)
.
map
(
key
=>
{
let
val
=
obj
[
key
];
if
(
typeof
val
===
undefined
||
val
===
null
)
{
val
=
''
;
}
else
if
(
isPlainObject
(
val
))
{
val
=
JSON
.
stringify
(
val
);
}
return
encodeStr
(
key
)
+
'
=
'
+
encodeStr
(
val
);
})
.
filter
(
x
=>
x
.
length
>
0
)
.
join
(
'
&
'
)
:
null
;
return
res
?
`?
${
res
}
`
:
''
;
}
function
initVueIds
(
vueIds
,
mpInstance
)
{
if
(
!
vueIds
)
{
return
;
...
...
@@ -261,6 +251,16 @@ function initVueIds(vueIds, mpInstance) {
mpInstance
.
_$vuePid
=
ids
[
1
];
}
}
function
initWxsCallMethods
(
methods
,
wxsCallMethods
)
{
if
(
!
isArray
(
wxsCallMethods
))
{
return
;
}
wxsCallMethods
.
forEach
((
callMethod
)
=>
{
methods
[
callMethod
]
=
function
(
args
)
{
return
this
.
$vm
[
callMethod
](
args
);
};
});
}
function
findVmByVueId
(
instance
,
vuePid
)
{
// TODO vue3 中 没有 $children
const
$children
=
instance
.
$children
;
...
...
@@ -971,11 +971,15 @@ function createVueComponent(mpType, mpInstance, vueOptions, parent) {
function
createPage
(
vueOptions
)
{
vueOptions
=
vueOptions
.
default
||
vueOptions
;
const
pageOptions
=
{
onLoad
(
args
)
{
onLoad
(
query
)
{
this
.
options
=
query
;
this
.
$page
=
{
fullPath
:
'
/
'
+
this
.
route
+
stringifyQuery
(
query
)
};
// 初始化 vue 实例
this
.
$vm
=
createVueComponent
(
'
page
'
,
this
,
vueOptions
);
initSpecialMethods
(
this
);
this
.
$vm
.
$callHook
(
'
onLoad
'
,
args
);
this
.
$vm
.
$callHook
(
'
onLoad
'
,
query
);
},
onReady
()
{
initChildVues
(
this
);
...
...
@@ -1003,6 +1007,7 @@ function createPage(vueOptions) {
}
initHooks
(
pageOptions
,
PAGE_HOOKS
);
initUnknownHooks
(
pageOptions
,
vueOptions
);
initWxsCallMethods
(
pageOptions
,
vueOptions
.
wxsCallMethods
);
return
Page
(
pageOptions
);
}
...
...
@@ -1099,6 +1104,7 @@ function createComponent(vueOptions) {
else
{
mpComponentOptions
.
didUpdate
=
createObserver
(
true
);
}
initWxsCallMethods
(
mpComponentOptions
.
methods
,
vueOptions
.
wxsCallMethods
);
return
Component
(
mpComponentOptions
);
}
...
...
packages/uni-mp-baidu/dist/index.js
浏览文件 @
7325d4b3
...
...
@@ -1897,6 +1897,11 @@ function parsePage (vuePageOptions) {
initRelation
});
const
onInit
=
(
vuePageOptions
.
default
||
vuePageOptions
).
onInit
;
if
(
onInit
)
{
pageOptions
.
methods
.
onInit
=
onInit
;
}
// 纠正百度小程序生命周期methods:onShow在methods:onLoad之前触发的问题
pageOptions
.
methods
.
onShow
=
function
onShow
()
{
if
(
this
.
$vm
&&
this
.
$vm
.
$mp
.
query
)
{
...
...
packages/uni-mp-baidu/dist/uni.api.esm.js
浏览文件 @
7325d4b3
import
{
isArray
,
isPromise
,
isFunction
,
isPlainObject
,
hasOwn
,
isString
}
from
'
@vue/shared
'
;
const
API_TYPE_SYNC
=
1
;
function
validateProtocol
(
_name
,
_args
,
_protocol
)
{
return
true
;
}
function
formatApiArgs
(
args
,
options
)
{
if
(
!
options
)
{
return
args
;
}
}
function
createApi
({
type
,
name
,
options
},
fn
,
protocol
)
{
return
function
(...
args
)
{
if
(
type
===
API_TYPE_SYNC
)
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
()))
{
return
fn
.
apply
(
null
,
formatApiArgs
(
args
,
options
));
}
}
};
}
const
Upx2pxProtocol
=
[
{
name
:
'
upx
'
,
type
:
[
Number
,
String
],
required
:
true
}
];
const
EPS
=
1
e
-
4
;
const
BASE_DEVICE_WIDTH
=
750
;
let
isIOS
=
false
;
...
...
@@ -11,7 +38,7 @@ function checkDeviceWidth() {
deviceDPR
=
pixelRatio
;
isIOS
=
platform
===
'
ios
'
;
}
function
upx2px
(
number
,
newDeviceWidth
)
{
const
upx2px
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
upx2px
'
},
(
number
,
newDeviceWidth
)
=>
{
if
(
deviceWidth
===
0
)
{
checkDeviceWidth
();
}
...
...
@@ -33,7 +60,7 @@ function upx2px(number, newDeviceWidth) {
}
}
return
number
<
0
?
-
result
:
result
;
}
}
,
Upx2pxProtocol
);
var
HOOKS
;
(
function
(
HOOKS
)
{
...
...
@@ -139,6 +166,15 @@ function invokeApi(method, api, options, ...params) {
return
api
(
options
,
...
params
);
}
const
AddInterceptorProtocol
=
[
{
name
:
'
method
'
,
type
:
[
String
,
Object
],
required
:
true
}
];
const
RemoveInterceptorProtocol
=
AddInterceptorProtocol
;
function
mergeInterceptorHook
(
interceptors
,
interceptor
)
{
Object
.
keys
(
interceptor
).
forEach
(
hook
=>
{
if
(
isFunction
(
interceptor
[
hook
]))
{
...
...
@@ -184,15 +220,15 @@ function removeHook(hooks, hook) {
hooks
.
splice
(
index
,
1
);
}
}
function
addInterceptor
(
method
,
interceptor
)
{
const
addInterceptor
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
addInterceptor
'
},
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
&&
isPlainObject
(
interceptor
))
{
mergeInterceptorHook
(
scopedInterceptors
[
method
]
||
(
scopedInterceptors
[
method
]
=
{}),
interceptor
);
}
else
if
(
isPlainObject
(
method
))
{
mergeInterceptorHook
(
globalInterceptors
,
method
);
}
}
function
removeInterceptor
(
method
,
interceptor
)
{
}
,
AddInterceptorProtocol
);
const
removeInterceptor
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
removeInterceptor
'
},
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
)
{
if
(
isPlainObject
(
interceptor
))
{
removeInterceptorHook
(
scopedInterceptors
[
method
],
interceptor
);
...
...
@@ -204,7 +240,7 @@ function removeInterceptor(method, interceptor) {
else
if
(
isPlainObject
(
method
))
{
removeInterceptorHook
(
globalInterceptors
,
method
);
}
}
}
,
RemoveInterceptorProtocol
);
const
SYNC_API_RE
=
/^
\$
|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
...
...
@@ -451,6 +487,19 @@ const getSystemInfo = {
returnValue
:
addSafeAreaInsets
};
const
getSystemInfoSync
=
getSystemInfo
;
const
redirectTo
=
{};
const
createCanvasContext
=
{
returnValue
(
fromRes
,
toRes
)
{
const
measureText
=
fromRes
.
measureText
;
toRes
.
measureText
=
function
(
text
,
callback
)
{
const
textMetrics
=
measureText
.
call
(
this
,
text
);
if
(
typeof
callback
===
'
function
'
)
{
setTimeout
(()
=>
callback
(
textMetrics
),
0
);
}
return
textMetrics
;
};
}
};
const
getProvider
=
initGetProvider
({
oauth
:
[
'
baidu
'
],
...
...
@@ -565,9 +614,11 @@ var protocols = /*#__PURE__*/Object.freeze({
navigateBackMiniProgram
:
navigateBackMiniProgram
,
showShareMenu
:
showShareMenu
,
getAccountInfoSync
:
getAccountInfoSync
,
redirectTo
:
redirectTo
,
previewImage
:
previewImage
,
getSystemInfo
:
getSystemInfo
,
getSystemInfoSync
:
getSystemInfoSync
getSystemInfoSync
:
getSystemInfoSync
,
createCanvasContext
:
createCanvasContext
});
var
index
=
initUni
(
shims
,
protocols
);
...
...
packages/uni-mp-baidu/dist/uni.mp.esm.js
浏览文件 @
7325d4b3
...
...
@@ -52,28 +52,6 @@ const MP_METHODS = [
'
selectAllComponents
'
,
'
selectComponent
'
];
function
hasHook
(
name
)
{
const
hooks
=
this
.
$
[
name
];
if
(
hooks
&&
hooks
.
length
)
{
return
true
;
}
return
false
;
}
function
callHook
(
name
,
args
)
{
if
(
name
===
'
mounted
'
)
{
callHook
.
call
(
this
,
'
bm
'
);
// beforeMount
this
.
$
.
isMounted
=
true
;
name
=
'
m
'
;
}
const
hooks
=
this
.
$
[
name
];
let
ret
;
if
(
hooks
)
{
for
(
let
i
=
0
;
i
<
hooks
.
length
;
i
++
)
{
ret
=
hooks
[
i
](
args
);
}
}
return
ret
;
}
function
createEmitFn
(
oldEmit
,
ctx
)
{
return
function
emit
(
event
,
...
args
)
{
if
(
ctx
.
$scope
&&
event
)
{
...
...
@@ -82,9 +60,6 @@ function createEmitFn(oldEmit, ctx) {
return
oldEmit
.
apply
(
this
,
[
event
,
...
args
]);
};
}
function
set
(
target
,
key
,
val
)
{
return
(
target
[
key
]
=
val
);
}
function
initBaseInstance
(
instance
,
options
)
{
const
ctx
=
instance
.
ctx
;
// mp
...
...
@@ -93,7 +68,9 @@ function initBaseInstance(instance, options) {
ctx
.
$scope
=
options
.
mpInstance
;
// TODO @deprecated
ctx
.
$mp
=
{};
if
(
__VUE_OPTIONS_API__
)
{
ctx
.
_self
=
{};
}
// $vm
ctx
.
$scope
.
$vm
=
instance
.
proxy
;
// slots
...
...
@@ -105,15 +82,8 @@ function initBaseInstance(instance, options) {
});
}
}
if
(
__VUE_OPTIONS_API__
)
{
// $set
ctx
.
$set
=
set
;
}
// $emit
instance
.
emit
=
createEmitFn
(
instance
.
emit
,
ctx
);
// $callHook
ctx
.
$hasHook
=
hasHook
;
ctx
.
$callHook
=
callHook
;
}
function
initComponentInstance
(
instance
,
options
)
{
initBaseInstance
(
instance
,
options
);
...
...
@@ -207,7 +177,7 @@ function parseApp(instance, parseAppOptions) {
$vm
:
instance
,
onLaunch
(
options
)
{
const
ctx
=
internalInstance
.
ctx
;
if
(
this
.
$vm
&&
ctx
.
$
callHook
)
{
if
(
this
.
$vm
&&
ctx
.
$
scope
)
{
// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
return
;
}
...
...
@@ -238,6 +208,26 @@ function initCreateApp(parseAppOptions) {
};
}
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
const
res
=
obj
?
Object
.
keys
(
obj
)
.
map
(
key
=>
{
let
val
=
obj
[
key
];
if
(
typeof
val
===
undefined
||
val
===
null
)
{
val
=
''
;
}
else
if
(
isPlainObject
(
val
))
{
val
=
JSON
.
stringify
(
val
);
}
return
encodeStr
(
key
)
+
'
=
'
+
encodeStr
(
val
);
})
.
filter
(
x
=>
x
.
length
>
0
)
.
join
(
'
&
'
)
:
null
;
return
res
?
`?
${
res
}
`
:
''
;
}
function
initBehavior
(
options
)
{
return
Behavior
(
options
);
}
...
...
@@ -810,6 +800,13 @@ function parsePage(vueOptions, parseOptions) {
initLifetimes
});
const
methods
=
miniProgramPageOptions
.
methods
;
methods
.
onLoad
=
function
(
query
)
{
this
.
options
=
query
;
this
.
$page
=
{
fullPath
:
'
/
'
+
this
.
route
+
stringifyQuery
(
query
)
};
return
this
.
$vm
&&
this
.
$vm
.
$callHook
(
'
onLoad
'
,
query
);
};
initHooks
(
methods
,
PAGE_HOOKS
);
initUnknownHooks
(
methods
,
vueOptions
);
parse
&&
parse
(
miniProgramPageOptions
,
{
handleLink
});
...
...
@@ -929,7 +926,7 @@ function handleLink(event) {
const
mocks
=
[
'
nodeId
'
,
'
componentName
'
,
'
_componentId
'
,
'
uniquePrefix
'
];
function
isPage
(
mpInstance
)
{
return
!
mpInstance
.
ownerId
;
return
!
hasOwn
(
mpInstance
,
'
ownerId
'
)
;
}
function
initRelation
(
mpInstance
,
detail
)
{
mpInstance
.
dispatch
(
'
__l
'
,
detail
);
...
...
packages/uni-mp-kuaishou/dist/index.js
浏览文件 @
7325d4b3
...
...
@@ -1317,7 +1317,9 @@ const hooks = [
'
onShow
'
,
'
onHide
'
,
'
onError
'
,
'
onPageNotFound
'
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onUnhandledRejection
'
];
function
parseBaseApp
(
vm
,
{
...
...
@@ -1393,17 +1395,19 @@ function parseBaseApp (vm, {
return
appOptions
}
/* 快手也使用__wxExparserNodeId__和__wxWebviewId__ */
const
mocks
=
[
'
__route__
'
,
'
__wxExparserNodeId__
'
,
'
__wxWebviewId__
'
];
function
findVmByVueId
(
vm
,
vuePid
)
{
const
$children
=
vm
.
$children
;
// 优先查找直属
let
parentVm
=
$children
.
find
(
childVm
=>
childVm
.
$scope
.
_$vueId
===
vuePid
);
if
(
parentVm
)
{
return
parentVm
// 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
for
(
let
i
=
$children
.
length
-
1
;
i
>=
0
;
i
--
)
{
const
childVm
=
$children
[
i
];
if
(
childVm
.
$scope
.
_$vueId
===
vuePid
)
{
return
childVm
}
}
// 反向递归查找
let
parentVm
;
for
(
let
i
=
$children
.
length
-
1
;
i
>=
0
;
i
--
)
{
parentVm
=
findVmByVueId
(
$children
[
i
],
vuePid
);
if
(
parentVm
)
{
...
...
@@ -1473,6 +1477,10 @@ function parseApp (vm) {
})
}
function
parseApp$1
(
vm
)
{
return
parseApp
(
vm
)
}
function
createApp
(
vm
)
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
...
...
@@ -1488,10 +1496,53 @@ function createApp (vm) {
}
return
callHook
.
call
(
this
,
hook
,
args
)
};
App
(
parseApp
(
vm
));
App
(
parseApp
$1
(
vm
));
return
vm
}
const
encodeReserveRE
=
/
[
!'()*
]
/g
;
const
encodeReserveReplacer
=
c
=>
'
%
'
+
c
.
charCodeAt
(
0
).
toString
(
16
);
const
commaRE
=
/%2C/g
;
// fixed encodeURIComponent which is more conformant to RFC3986:
// - escapes [!'()*]
// - preserve commas
const
encode
=
str
=>
encodeURIComponent
(
str
)
.
replace
(
encodeReserveRE
,
encodeReserveReplacer
)
.
replace
(
commaRE
,
'
,
'
);
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
const
res
=
obj
?
Object
.
keys
(
obj
).
map
(
key
=>
{
const
val
=
obj
[
key
];
if
(
val
===
undefined
)
{
return
''
}
if
(
val
===
null
)
{
return
encodeStr
(
key
)
}
if
(
Array
.
isArray
(
val
))
{
const
result
=
[];
val
.
forEach
(
val2
=>
{
if
(
val2
===
undefined
)
{
return
}
if
(
val2
===
null
)
{
result
.
push
(
encodeStr
(
key
));
}
else
{
result
.
push
(
encodeStr
(
key
)
+
'
=
'
+
encodeStr
(
val2
));
}
});
return
result
.
join
(
'
&
'
)
}
return
encodeStr
(
key
)
+
'
=
'
+
encodeStr
(
val
)
}).
filter
(
x
=>
x
.
length
>
0
).
join
(
'
&
'
)
:
null
;
return
res
?
`?
${
res
}
`
:
''
}
function
parseBaseComponent
(
vueComponentOptions
,
{
isPage
,
initRelation
...
...
@@ -1500,7 +1551,8 @@ function parseBaseComponent (vueComponentOptions, {
const
options
=
{
multipleSlots
:
true
,
addGlobalClass
:
true
addGlobalClass
:
true
,
...(
vueOptions
.
options
||
{})
};
const
componentOptions
=
{
...
...
@@ -1545,7 +1597,7 @@ function parseBaseComponent (vueComponentOptions, {
}
},
detached
()
{
this
.
$vm
.
$destroy
();
this
.
$vm
&&
this
.
$vm
.
$destroy
();
}
},
pageLifetimes
:
{
...
...
@@ -1564,6 +1616,10 @@ function parseBaseComponent (vueComponentOptions, {
__e
:
handleEvent
}
};
// externalClasses
if
(
vueOptions
.
externalClasses
)
{
componentOptions
.
externalClasses
=
vueOptions
.
externalClasses
;
}
if
(
Array
.
isArray
(
vueOptions
.
wxsCallMethods
))
{
vueOptions
.
wxsCallMethods
.
forEach
(
callMethod
=>
{
...
...
@@ -1586,6 +1642,10 @@ function parseComponent (vueComponentOptions) {
})
}
function
parseComponent$1
(
vueComponentOptions
)
{
return
parseComponent
(
vueComponentOptions
)
}
const
hooks$1
=
[
'
onShow
'
,
'
onHide
'
,
...
...
@@ -1598,13 +1658,19 @@ function parseBasePage (vuePageOptions, {
isPage
,
initRelation
})
{
const
pageOptions
=
parseComponent
(
vuePageOptions
);
const
pageOptions
=
parseComponent
$1
(
vuePageOptions
);
initHooks
(
pageOptions
.
methods
,
hooks$1
,
vuePageOptions
);
pageOptions
.
methods
.
onLoad
=
function
(
args
)
{
this
.
$vm
.
$mp
.
query
=
args
;
// 兼容 mpvue
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
);
pageOptions
.
methods
.
onLoad
=
function
(
query
)
{
this
.
options
=
query
;
const
copyQuery
=
Object
.
assign
({},
query
);
delete
copyQuery
.
__id__
;
this
.
$page
=
{
fullPath
:
'
/
'
+
(
this
.
route
||
this
.
is
)
+
stringifyQuery
(
copyQuery
)
};
this
.
$vm
.
$mp
.
query
=
query
;
// 兼容 mpvue
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
query
);
};
return
pageOptions
...
...
@@ -1617,15 +1683,19 @@ function parsePage (vuePageOptions) {
})
}
function
parsePage$1
(
vuePageOptions
)
{
return
parsePage
(
vuePageOptions
)
}
function
createPage
(
vuePageOptions
)
{
{
return
Component
(
parsePage
(
vuePageOptions
))
return
Component
(
parsePage
$1
(
vuePageOptions
))
}
}
function
createComponent
(
vueOptions
)
{
{
return
Component
(
parseComponent
(
vueOptions
))
return
Component
(
parseComponent
$1
(
vueOptions
))
}
}
...
...
packages/uni-mp-qq/dist/uni.api.esm.js
浏览文件 @
7325d4b3
import
{
isArray
,
isPromise
,
isFunction
,
isPlainObject
,
hasOwn
,
isString
}
from
'
@vue/shared
'
;
const
API_TYPE_SYNC
=
1
;
function
validateProtocol
(
_name
,
_args
,
_protocol
)
{
return
true
;
}
function
formatApiArgs
(
args
,
options
)
{
if
(
!
options
)
{
return
args
;
}
}
function
createApi
({
type
,
name
,
options
},
fn
,
protocol
)
{
return
function
(...
args
)
{
if
(
type
===
API_TYPE_SYNC
)
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
()))
{
return
fn
.
apply
(
null
,
formatApiArgs
(
args
,
options
));
}
}
};
}
const
Upx2pxProtocol
=
[
{
name
:
'
upx
'
,
type
:
[
Number
,
String
],
required
:
true
}
];
const
EPS
=
1
e
-
4
;
const
BASE_DEVICE_WIDTH
=
750
;
let
isIOS
=
false
;
...
...
@@ -11,7 +38,7 @@ function checkDeviceWidth() {
deviceDPR
=
pixelRatio
;
isIOS
=
platform
===
'
ios
'
;
}
function
upx2px
(
number
,
newDeviceWidth
)
{
const
upx2px
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
upx2px
'
},
(
number
,
newDeviceWidth
)
=>
{
if
(
deviceWidth
===
0
)
{
checkDeviceWidth
();
}
...
...
@@ -33,7 +60,7 @@ function upx2px(number, newDeviceWidth) {
}
}
return
number
<
0
?
-
result
:
result
;
}
}
,
Upx2pxProtocol
);
var
HOOKS
;
(
function
(
HOOKS
)
{
...
...
@@ -139,6 +166,15 @@ function invokeApi(method, api, options, ...params) {
return
api
(
options
,
...
params
);
}
const
AddInterceptorProtocol
=
[
{
name
:
'
method
'
,
type
:
[
String
,
Object
],
required
:
true
}
];
const
RemoveInterceptorProtocol
=
AddInterceptorProtocol
;
function
mergeInterceptorHook
(
interceptors
,
interceptor
)
{
Object
.
keys
(
interceptor
).
forEach
(
hook
=>
{
if
(
isFunction
(
interceptor
[
hook
]))
{
...
...
@@ -184,15 +220,15 @@ function removeHook(hooks, hook) {
hooks
.
splice
(
index
,
1
);
}
}
function
addInterceptor
(
method
,
interceptor
)
{
const
addInterceptor
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
addInterceptor
'
},
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
&&
isPlainObject
(
interceptor
))
{
mergeInterceptorHook
(
scopedInterceptors
[
method
]
||
(
scopedInterceptors
[
method
]
=
{}),
interceptor
);
}
else
if
(
isPlainObject
(
method
))
{
mergeInterceptorHook
(
globalInterceptors
,
method
);
}
}
function
removeInterceptor
(
method
,
interceptor
)
{
}
,
AddInterceptorProtocol
);
const
removeInterceptor
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
removeInterceptor
'
},
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
)
{
if
(
isPlainObject
(
interceptor
))
{
removeInterceptorHook
(
scopedInterceptors
[
method
],
interceptor
);
...
...
@@ -204,7 +240,7 @@ function removeInterceptor(method, interceptor) {
else
if
(
isPlainObject
(
method
))
{
removeInterceptorHook
(
globalInterceptors
,
method
);
}
}
}
,
RemoveInterceptorProtocol
);
const
SYNC_API_RE
=
/^
\$
|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
...
...
@@ -451,6 +487,19 @@ const getSystemInfo = {
returnValue
:
addSafeAreaInsets
};
const
getSystemInfoSync
=
getSystemInfo
;
const
redirectTo
=
{};
const
createCanvasContext
=
{
returnValue
(
fromRes
,
toRes
)
{
const
measureText
=
fromRes
.
measureText
;
toRes
.
measureText
=
function
(
text
,
callback
)
{
const
textMetrics
=
measureText
.
call
(
this
,
text
);
if
(
typeof
callback
===
'
function
'
)
{
setTimeout
(()
=>
callback
(
textMetrics
),
0
);
}
return
textMetrics
;
};
}
};
const
getProvider
=
initGetProvider
({
oauth
:
[
'
qq
'
],
...
...
@@ -466,9 +515,11 @@ var shims = /*#__PURE__*/Object.freeze({
var
protocols
=
/*#__PURE__*/
Object
.
freeze
({
__proto__
:
null
,
redirectTo
:
redirectTo
,
previewImage
:
previewImage
,
getSystemInfo
:
getSystemInfo
,
getSystemInfoSync
:
getSystemInfoSync
getSystemInfoSync
:
getSystemInfoSync
,
createCanvasContext
:
createCanvasContext
});
var
index
=
initUni
(
shims
,
protocols
);
...
...
packages/uni-mp-qq/dist/uni.mp.esm.js
浏览文件 @
7325d4b3
...
...
@@ -52,28 +52,6 @@ const MP_METHODS = [
'
selectAllComponents
'
,
'
selectComponent
'
];
function
hasHook
(
name
)
{
const
hooks
=
this
.
$
[
name
];
if
(
hooks
&&
hooks
.
length
)
{
return
true
;
}
return
false
;
}
function
callHook
(
name
,
args
)
{
if
(
name
===
'
mounted
'
)
{
callHook
.
call
(
this
,
'
bm
'
);
// beforeMount
this
.
$
.
isMounted
=
true
;
name
=
'
m
'
;
}
const
hooks
=
this
.
$
[
name
];
let
ret
;
if
(
hooks
)
{
for
(
let
i
=
0
;
i
<
hooks
.
length
;
i
++
)
{
ret
=
hooks
[
i
](
args
);
}
}
return
ret
;
}
function
createEmitFn
(
oldEmit
,
ctx
)
{
return
function
emit
(
event
,
...
args
)
{
if
(
ctx
.
$scope
&&
event
)
{
...
...
@@ -82,9 +60,6 @@ function createEmitFn(oldEmit, ctx) {
return
oldEmit
.
apply
(
this
,
[
event
,
...
args
]);
};
}
function
set
(
target
,
key
,
val
)
{
return
(
target
[
key
]
=
val
);
}
function
initBaseInstance
(
instance
,
options
)
{
const
ctx
=
instance
.
ctx
;
// mp
...
...
@@ -93,7 +68,9 @@ function initBaseInstance(instance, options) {
ctx
.
$scope
=
options
.
mpInstance
;
// TODO @deprecated
ctx
.
$mp
=
{};
if
(
__VUE_OPTIONS_API__
)
{
ctx
.
_self
=
{};
}
// $vm
ctx
.
$scope
.
$vm
=
instance
.
proxy
;
// slots
...
...
@@ -105,15 +82,8 @@ function initBaseInstance(instance, options) {
});
}
}
if
(
__VUE_OPTIONS_API__
)
{
// $set
ctx
.
$set
=
set
;
}
// $emit
instance
.
emit
=
createEmitFn
(
instance
.
emit
,
ctx
);
// $callHook
ctx
.
$hasHook
=
hasHook
;
ctx
.
$callHook
=
callHook
;
}
function
initComponentInstance
(
instance
,
options
)
{
initBaseInstance
(
instance
,
options
);
...
...
@@ -207,7 +177,7 @@ function parseApp(instance, parseAppOptions) {
$vm
:
instance
,
onLaunch
(
options
)
{
const
ctx
=
internalInstance
.
ctx
;
if
(
this
.
$vm
&&
ctx
.
$
callHook
)
{
if
(
this
.
$vm
&&
ctx
.
$
scope
)
{
// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
return
;
}
...
...
@@ -238,6 +208,26 @@ function initCreateApp(parseAppOptions) {
};
}
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
const
res
=
obj
?
Object
.
keys
(
obj
)
.
map
(
key
=>
{
let
val
=
obj
[
key
];
if
(
typeof
val
===
undefined
||
val
===
null
)
{
val
=
''
;
}
else
if
(
isPlainObject
(
val
))
{
val
=
JSON
.
stringify
(
val
);
}
return
encodeStr
(
key
)
+
'
=
'
+
encodeStr
(
val
);
})
.
filter
(
x
=>
x
.
length
>
0
)
.
join
(
'
&
'
)
:
null
;
return
res
?
`?
${
res
}
`
:
''
;
}
function
initBehavior
(
options
)
{
return
Behavior
(
options
);
}
...
...
@@ -791,6 +781,13 @@ function parsePage(vueOptions, parseOptions) {
initLifetimes
});
const
methods
=
miniProgramPageOptions
.
methods
;
methods
.
onLoad
=
function
(
query
)
{
this
.
options
=
query
;
this
.
$page
=
{
fullPath
:
'
/
'
+
this
.
route
+
stringifyQuery
(
query
)
};
return
this
.
$vm
&&
this
.
$vm
.
$callHook
(
'
onLoad
'
,
query
);
};
initHooks
(
methods
,
PAGE_HOOKS
);
initUnknownHooks
(
methods
,
vueOptions
);
parse
&&
parse
(
miniProgramPageOptions
,
{
handleLink
});
...
...
packages/uni-mp-toutiao/dist/uni.api.esm.js
浏览文件 @
7325d4b3
import
{
isArray
,
isPromise
,
isFunction
,
isPlainObject
,
hasOwn
,
isString
}
from
'
@vue/shared
'
;
const
API_TYPE_SYNC
=
1
;
function
validateProtocol
(
_name
,
_args
,
_protocol
)
{
return
true
;
}
function
formatApiArgs
(
args
,
options
)
{
if
(
!
options
)
{
return
args
;
}
}
function
createApi
({
type
,
name
,
options
},
fn
,
protocol
)
{
return
function
(...
args
)
{
if
(
type
===
API_TYPE_SYNC
)
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
()))
{
return
fn
.
apply
(
null
,
formatApiArgs
(
args
,
options
));
}
}
};
}
const
Upx2pxProtocol
=
[
{
name
:
'
upx
'
,
type
:
[
Number
,
String
],
required
:
true
}
];
const
EPS
=
1
e
-
4
;
const
BASE_DEVICE_WIDTH
=
750
;
let
isIOS
=
false
;
...
...
@@ -11,7 +38,7 @@ function checkDeviceWidth() {
deviceDPR
=
pixelRatio
;
isIOS
=
platform
===
'
ios
'
;
}
function
upx2px
(
number
,
newDeviceWidth
)
{
const
upx2px
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
upx2px
'
},
(
number
,
newDeviceWidth
)
=>
{
if
(
deviceWidth
===
0
)
{
checkDeviceWidth
();
}
...
...
@@ -33,7 +60,7 @@ function upx2px(number, newDeviceWidth) {
}
}
return
number
<
0
?
-
result
:
result
;
}
}
,
Upx2pxProtocol
);
var
HOOKS
;
(
function
(
HOOKS
)
{
...
...
@@ -139,6 +166,15 @@ function invokeApi(method, api, options, ...params) {
return
api
(
options
,
...
params
);
}
const
AddInterceptorProtocol
=
[
{
name
:
'
method
'
,
type
:
[
String
,
Object
],
required
:
true
}
];
const
RemoveInterceptorProtocol
=
AddInterceptorProtocol
;
function
mergeInterceptorHook
(
interceptors
,
interceptor
)
{
Object
.
keys
(
interceptor
).
forEach
(
hook
=>
{
if
(
isFunction
(
interceptor
[
hook
]))
{
...
...
@@ -184,15 +220,15 @@ function removeHook(hooks, hook) {
hooks
.
splice
(
index
,
1
);
}
}
function
addInterceptor
(
method
,
interceptor
)
{
const
addInterceptor
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
addInterceptor
'
},
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
&&
isPlainObject
(
interceptor
))
{
mergeInterceptorHook
(
scopedInterceptors
[
method
]
||
(
scopedInterceptors
[
method
]
=
{}),
interceptor
);
}
else
if
(
isPlainObject
(
method
))
{
mergeInterceptorHook
(
globalInterceptors
,
method
);
}
}
function
removeInterceptor
(
method
,
interceptor
)
{
}
,
AddInterceptorProtocol
);
const
removeInterceptor
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
removeInterceptor
'
},
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
)
{
if
(
isPlainObject
(
interceptor
))
{
removeInterceptorHook
(
scopedInterceptors
[
method
],
interceptor
);
...
...
@@ -204,7 +240,7 @@ function removeInterceptor(method, interceptor) {
else
if
(
isPlainObject
(
method
))
{
removeInterceptorHook
(
globalInterceptors
,
method
);
}
}
}
,
RemoveInterceptorProtocol
);
const
SYNC_API_RE
=
/^
\$
|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
...
...
@@ -436,6 +472,19 @@ const previewImage = {
};
}
};
const
redirectTo
=
{};
const
createCanvasContext
=
{
returnValue
(
fromRes
,
toRes
)
{
const
measureText
=
fromRes
.
measureText
;
toRes
.
measureText
=
function
(
text
,
callback
)
{
const
textMetrics
=
measureText
.
call
(
this
,
text
);
if
(
typeof
callback
===
'
function
'
)
{
setTimeout
(()
=>
callback
(
textMetrics
),
0
);
}
return
textMetrics
;
};
}
};
const
getProvider
=
initGetProvider
({
oauth
:
[
'
toutiao
'
],
...
...
@@ -536,7 +585,9 @@ var protocols = /*#__PURE__*/Object.freeze({
getUserInfo
:
getUserInfo
,
requestPayment
:
requestPayment
,
getFileInfo
:
getFileInfo
,
previewImage
:
previewImage
redirectTo
:
redirectTo
,
previewImage
:
previewImage
,
createCanvasContext
:
createCanvasContext
});
var
index
=
initUni
(
shims
,
protocols
);
...
...
packages/uni-mp-toutiao/dist/uni.mp.esm.js
浏览文件 @
7325d4b3
...
...
@@ -52,28 +52,6 @@ const MP_METHODS = [
'
selectAllComponents
'
,
'
selectComponent
'
];
function
hasHook
(
name
)
{
const
hooks
=
this
.
$
[
name
];
if
(
hooks
&&
hooks
.
length
)
{
return
true
;
}
return
false
;
}
function
callHook
(
name
,
args
)
{
if
(
name
===
'
mounted
'
)
{
callHook
.
call
(
this
,
'
bm
'
);
// beforeMount
this
.
$
.
isMounted
=
true
;
name
=
'
m
'
;
}
const
hooks
=
this
.
$
[
name
];
let
ret
;
if
(
hooks
)
{
for
(
let
i
=
0
;
i
<
hooks
.
length
;
i
++
)
{
ret
=
hooks
[
i
](
args
);
}
}
return
ret
;
}
function
createEmitFn
(
oldEmit
,
ctx
)
{
return
function
emit
(
event
,
...
args
)
{
if
(
ctx
.
$scope
&&
event
)
{
...
...
@@ -82,9 +60,6 @@ function createEmitFn(oldEmit, ctx) {
return
oldEmit
.
apply
(
this
,
[
event
,
...
args
]);
};
}
function
set
(
target
,
key
,
val
)
{
return
(
target
[
key
]
=
val
);
}
function
initBaseInstance
(
instance
,
options
)
{
const
ctx
=
instance
.
ctx
;
// mp
...
...
@@ -93,7 +68,9 @@ function initBaseInstance(instance, options) {
ctx
.
$scope
=
options
.
mpInstance
;
// TODO @deprecated
ctx
.
$mp
=
{};
if
(
__VUE_OPTIONS_API__
)
{
ctx
.
_self
=
{};
}
// $vm
ctx
.
$scope
.
$vm
=
instance
.
proxy
;
// slots
...
...
@@ -105,15 +82,8 @@ function initBaseInstance(instance, options) {
});
}
}
if
(
__VUE_OPTIONS_API__
)
{
// $set
ctx
.
$set
=
set
;
}
// $emit
instance
.
emit
=
createEmitFn
(
instance
.
emit
,
ctx
);
// $callHook
ctx
.
$hasHook
=
hasHook
;
ctx
.
$callHook
=
callHook
;
}
function
initComponentInstance
(
instance
,
options
)
{
initBaseInstance
(
instance
,
options
);
...
...
@@ -210,7 +180,7 @@ function parseApp(instance, parseAppOptions) {
$vm
:
instance
,
onLaunch
(
options
)
{
const
ctx
=
internalInstance
.
ctx
;
if
(
this
.
$vm
&&
ctx
.
$
callHook
)
{
if
(
this
.
$vm
&&
ctx
.
$
scope
)
{
// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
return
;
}
...
...
@@ -241,6 +211,26 @@ function initCreateApp(parseAppOptions) {
};
}
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
const
res
=
obj
?
Object
.
keys
(
obj
)
.
map
(
key
=>
{
let
val
=
obj
[
key
];
if
(
typeof
val
===
undefined
||
val
===
null
)
{
val
=
''
;
}
else
if
(
isPlainObject
(
val
))
{
val
=
JSON
.
stringify
(
val
);
}
return
encodeStr
(
key
)
+
'
=
'
+
encodeStr
(
val
);
})
.
filter
(
x
=>
x
.
length
>
0
)
.
join
(
'
&
'
)
:
null
;
return
res
?
`?
${
res
}
`
:
''
;
}
function
initBehavior
(
options
)
{
return
Behavior
(
options
);
}
...
...
@@ -800,6 +790,13 @@ function parsePage(vueOptions, parseOptions) {
initLifetimes
});
const
methods
=
miniProgramPageOptions
.
methods
;
methods
.
onLoad
=
function
(
query
)
{
this
.
options
=
query
;
this
.
$page
=
{
fullPath
:
'
/
'
+
this
.
route
+
stringifyQuery
(
query
)
};
return
this
.
$vm
&&
this
.
$vm
.
$callHook
(
'
onLoad
'
,
query
);
};
initHooks
(
methods
,
PAGE_HOOKS
);
initUnknownHooks
(
methods
,
vueOptions
);
parse
&&
parse
(
miniProgramPageOptions
,
{
handleLink
});
...
...
packages/uni-mp-vue/dist/vue.runtime.esm.js
浏览文件 @
7325d4b3
此差异已折叠。
点击以展开。
packages/uni-mp-weixin/dist/uni.api.esm.js
浏览文件 @
7325d4b3
import
{
isArray
,
isPromise
,
isFunction
,
isPlainObject
,
hasOwn
,
isString
}
from
'
@vue/shared
'
;
const
API_TYPE_SYNC
=
1
;
function
validateProtocol
(
_name
,
_args
,
_protocol
)
{
return
true
;
}
function
formatApiArgs
(
args
,
options
)
{
if
(
!
options
)
{
return
args
;
}
}
function
createApi
({
type
,
name
,
options
},
fn
,
protocol
)
{
return
function
(...
args
)
{
if
(
type
===
API_TYPE_SYNC
)
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
()))
{
return
fn
.
apply
(
null
,
formatApiArgs
(
args
,
options
));
}
}
};
}
const
Upx2pxProtocol
=
[
{
name
:
'
upx
'
,
type
:
[
Number
,
String
],
required
:
true
}
];
const
EPS
=
1
e
-
4
;
const
BASE_DEVICE_WIDTH
=
750
;
let
isIOS
=
false
;
...
...
@@ -11,7 +38,7 @@ function checkDeviceWidth() {
deviceDPR
=
pixelRatio
;
isIOS
=
platform
===
'
ios
'
;
}
function
upx2px
(
number
,
newDeviceWidth
)
{
const
upx2px
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
upx2px
'
},
(
number
,
newDeviceWidth
)
=>
{
if
(
deviceWidth
===
0
)
{
checkDeviceWidth
();
}
...
...
@@ -33,7 +60,7 @@ function upx2px(number, newDeviceWidth) {
}
}
return
number
<
0
?
-
result
:
result
;
}
}
,
Upx2pxProtocol
);
var
HOOKS
;
(
function
(
HOOKS
)
{
...
...
@@ -139,6 +166,15 @@ function invokeApi(method, api, options, ...params) {
return
api
(
options
,
...
params
);
}
const
AddInterceptorProtocol
=
[
{
name
:
'
method
'
,
type
:
[
String
,
Object
],
required
:
true
}
];
const
RemoveInterceptorProtocol
=
AddInterceptorProtocol
;
function
mergeInterceptorHook
(
interceptors
,
interceptor
)
{
Object
.
keys
(
interceptor
).
forEach
(
hook
=>
{
if
(
isFunction
(
interceptor
[
hook
]))
{
...
...
@@ -184,15 +220,15 @@ function removeHook(hooks, hook) {
hooks
.
splice
(
index
,
1
);
}
}
function
addInterceptor
(
method
,
interceptor
)
{
const
addInterceptor
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
addInterceptor
'
},
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
&&
isPlainObject
(
interceptor
))
{
mergeInterceptorHook
(
scopedInterceptors
[
method
]
||
(
scopedInterceptors
[
method
]
=
{}),
interceptor
);
}
else
if
(
isPlainObject
(
method
))
{
mergeInterceptorHook
(
globalInterceptors
,
method
);
}
}
function
removeInterceptor
(
method
,
interceptor
)
{
}
,
AddInterceptorProtocol
);
const
removeInterceptor
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
removeInterceptor
'
},
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
)
{
if
(
isPlainObject
(
interceptor
))
{
removeInterceptorHook
(
scopedInterceptors
[
method
],
interceptor
);
...
...
@@ -204,7 +240,7 @@ function removeInterceptor(method, interceptor) {
else
if
(
isPlainObject
(
method
))
{
removeInterceptorHook
(
globalInterceptors
,
method
);
}
}
}
,
RemoveInterceptorProtocol
);
const
SYNC_API_RE
=
/^
\$
|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
...
...
@@ -451,6 +487,19 @@ const getSystemInfo = {
returnValue
:
addSafeAreaInsets
};
const
getSystemInfoSync
=
getSystemInfo
;
const
redirectTo
=
{};
const
createCanvasContext
=
{
returnValue
(
fromRes
,
toRes
)
{
const
measureText
=
fromRes
.
measureText
;
toRes
.
measureText
=
function
(
text
,
callback
)
{
const
textMetrics
=
measureText
.
call
(
this
,
text
);
if
(
typeof
callback
===
'
function
'
)
{
setTimeout
(()
=>
callback
(
textMetrics
),
0
);
}
return
textMetrics
;
};
}
};
const
getProvider
=
initGetProvider
({
oauth
:
[
'
weixin
'
],
...
...
@@ -466,9 +515,11 @@ var shims = /*#__PURE__*/Object.freeze({
var
protocols
=
/*#__PURE__*/
Object
.
freeze
({
__proto__
:
null
,
redirectTo
:
redirectTo
,
previewImage
:
previewImage
,
getSystemInfo
:
getSystemInfo
,
getSystemInfoSync
:
getSystemInfoSync
getSystemInfoSync
:
getSystemInfoSync
,
createCanvasContext
:
createCanvasContext
});
var
index
=
initUni
(
shims
,
protocols
);
...
...
packages/uni-mp-weixin/dist/uni.mp.esm.js
浏览文件 @
7325d4b3
...
...
@@ -52,28 +52,6 @@ const MP_METHODS = [
'
selectAllComponents
'
,
'
selectComponent
'
];
function
hasHook
(
name
)
{
const
hooks
=
this
.
$
[
name
];
if
(
hooks
&&
hooks
.
length
)
{
return
true
;
}
return
false
;
}
function
callHook
(
name
,
args
)
{
if
(
name
===
'
mounted
'
)
{
callHook
.
call
(
this
,
'
bm
'
);
// beforeMount
this
.
$
.
isMounted
=
true
;
name
=
'
m
'
;
}
const
hooks
=
this
.
$
[
name
];
let
ret
;
if
(
hooks
)
{
for
(
let
i
=
0
;
i
<
hooks
.
length
;
i
++
)
{
ret
=
hooks
[
i
](
args
);
}
}
return
ret
;
}
function
createEmitFn
(
oldEmit
,
ctx
)
{
return
function
emit
(
event
,
...
args
)
{
if
(
ctx
.
$scope
&&
event
)
{
...
...
@@ -82,9 +60,6 @@ function createEmitFn(oldEmit, ctx) {
return
oldEmit
.
apply
(
this
,
[
event
,
...
args
]);
};
}
function
set
(
target
,
key
,
val
)
{
return
(
target
[
key
]
=
val
);
}
function
initBaseInstance
(
instance
,
options
)
{
const
ctx
=
instance
.
ctx
;
// mp
...
...
@@ -93,7 +68,9 @@ function initBaseInstance(instance, options) {
ctx
.
$scope
=
options
.
mpInstance
;
// TODO @deprecated
ctx
.
$mp
=
{};
if
(
__VUE_OPTIONS_API__
)
{
ctx
.
_self
=
{};
}
// $vm
ctx
.
$scope
.
$vm
=
instance
.
proxy
;
// slots
...
...
@@ -105,15 +82,8 @@ function initBaseInstance(instance, options) {
});
}
}
if
(
__VUE_OPTIONS_API__
)
{
// $set
ctx
.
$set
=
set
;
}
// $emit
instance
.
emit
=
createEmitFn
(
instance
.
emit
,
ctx
);
// $callHook
ctx
.
$hasHook
=
hasHook
;
ctx
.
$callHook
=
callHook
;
}
function
initComponentInstance
(
instance
,
options
)
{
initBaseInstance
(
instance
,
options
);
...
...
@@ -207,7 +177,7 @@ function parseApp(instance, parseAppOptions) {
$vm
:
instance
,
onLaunch
(
options
)
{
const
ctx
=
internalInstance
.
ctx
;
if
(
this
.
$vm
&&
ctx
.
$
callHook
)
{
if
(
this
.
$vm
&&
ctx
.
$
scope
)
{
// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
return
;
}
...
...
@@ -238,6 +208,26 @@ function initCreateApp(parseAppOptions) {
};
}
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
const
res
=
obj
?
Object
.
keys
(
obj
)
.
map
(
key
=>
{
let
val
=
obj
[
key
];
if
(
typeof
val
===
undefined
||
val
===
null
)
{
val
=
''
;
}
else
if
(
isPlainObject
(
val
))
{
val
=
JSON
.
stringify
(
val
);
}
return
encodeStr
(
key
)
+
'
=
'
+
encodeStr
(
val
);
})
.
filter
(
x
=>
x
.
length
>
0
)
.
join
(
'
&
'
)
:
null
;
return
res
?
`?
${
res
}
`
:
''
;
}
function
initBehavior
(
options
)
{
return
Behavior
(
options
);
}
...
...
@@ -791,6 +781,13 @@ function parsePage(vueOptions, parseOptions) {
initLifetimes
});
const
methods
=
miniProgramPageOptions
.
methods
;
methods
.
onLoad
=
function
(
query
)
{
this
.
options
=
query
;
this
.
$page
=
{
fullPath
:
'
/
'
+
this
.
route
+
stringifyQuery
(
query
)
};
return
this
.
$vm
&&
this
.
$vm
.
$callHook
(
'
onLoad
'
,
query
);
};
initHooks
(
methods
,
PAGE_HOOKS
);
initUnknownHooks
(
methods
,
vueOptions
);
parse
&&
parse
(
miniProgramPageOptions
,
{
handleLink
});
...
...
packages/uni-quickapp-webview/dist/uni.api.esm.js
浏览文件 @
7325d4b3
import
{
isArray
,
isPromise
,
isFunction
,
isPlainObject
,
hasOwn
,
isString
}
from
'
@vue/shared
'
;
const
API_TYPE_SYNC
=
1
;
function
validateProtocol
(
_name
,
_args
,
_protocol
)
{
return
true
;
}
function
formatApiArgs
(
args
,
options
)
{
if
(
!
options
)
{
return
args
;
}
}
function
createApi
({
type
,
name
,
options
},
fn
,
protocol
)
{
return
function
(...
args
)
{
if
(
type
===
API_TYPE_SYNC
)
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
()))
{
return
fn
.
apply
(
null
,
formatApiArgs
(
args
,
options
));
}
}
};
}
const
Upx2pxProtocol
=
[
{
name
:
'
upx
'
,
type
:
[
Number
,
String
],
required
:
true
}
];
const
EPS
=
1
e
-
4
;
const
BASE_DEVICE_WIDTH
=
750
;
let
isIOS
=
false
;
...
...
@@ -11,7 +38,7 @@ function checkDeviceWidth() {
deviceDPR
=
pixelRatio
;
isIOS
=
platform
===
'
ios
'
;
}
function
upx2px
(
number
,
newDeviceWidth
)
{
const
upx2px
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
upx2px
'
},
(
number
,
newDeviceWidth
)
=>
{
if
(
deviceWidth
===
0
)
{
checkDeviceWidth
();
}
...
...
@@ -33,7 +60,7 @@ function upx2px(number, newDeviceWidth) {
}
}
return
number
<
0
?
-
result
:
result
;
}
}
,
Upx2pxProtocol
);
var
HOOKS
;
(
function
(
HOOKS
)
{
...
...
@@ -139,6 +166,15 @@ function invokeApi(method, api, options, ...params) {
return
api
(
options
,
...
params
);
}
const
AddInterceptorProtocol
=
[
{
name
:
'
method
'
,
type
:
[
String
,
Object
],
required
:
true
}
];
const
RemoveInterceptorProtocol
=
AddInterceptorProtocol
;
function
mergeInterceptorHook
(
interceptors
,
interceptor
)
{
Object
.
keys
(
interceptor
).
forEach
(
hook
=>
{
if
(
isFunction
(
interceptor
[
hook
]))
{
...
...
@@ -184,15 +220,15 @@ function removeHook(hooks, hook) {
hooks
.
splice
(
index
,
1
);
}
}
function
addInterceptor
(
method
,
interceptor
)
{
const
addInterceptor
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
addInterceptor
'
},
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
&&
isPlainObject
(
interceptor
))
{
mergeInterceptorHook
(
scopedInterceptors
[
method
]
||
(
scopedInterceptors
[
method
]
=
{}),
interceptor
);
}
else
if
(
isPlainObject
(
method
))
{
mergeInterceptorHook
(
globalInterceptors
,
method
);
}
}
function
removeInterceptor
(
method
,
interceptor
)
{
}
,
AddInterceptorProtocol
);
const
removeInterceptor
=
createApi
({
type
:
API_TYPE_SYNC
,
name
:
'
removeInterceptor
'
},
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
)
{
if
(
isPlainObject
(
interceptor
))
{
removeInterceptorHook
(
scopedInterceptors
[
method
],
interceptor
);
...
...
@@ -204,7 +240,7 @@ function removeInterceptor(method, interceptor) {
else
if
(
isPlainObject
(
method
))
{
removeInterceptorHook
(
globalInterceptors
,
method
);
}
}
}
,
RemoveInterceptorProtocol
);
const
SYNC_API_RE
=
/^
\$
|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
...
...
@@ -451,6 +487,19 @@ const getSystemInfo = {
returnValue
:
addSafeAreaInsets
};
const
getSystemInfoSync
=
getSystemInfo
;
const
redirectTo
=
{};
const
createCanvasContext
=
{
returnValue
(
fromRes
,
toRes
)
{
const
measureText
=
fromRes
.
measureText
;
toRes
.
measureText
=
function
(
text
,
callback
)
{
const
textMetrics
=
measureText
.
call
(
this
,
text
);
if
(
typeof
callback
===
'
function
'
)
{
setTimeout
(()
=>
callback
(
textMetrics
),
0
);
}
return
textMetrics
;
};
}
};
const
providers
=
{
oauth
:
[],
...
...
@@ -473,9 +522,11 @@ var shims = /*#__PURE__*/Object.freeze({
var
protocols
=
/*#__PURE__*/
Object
.
freeze
({
__proto__
:
null
,
redirectTo
:
redirectTo
,
previewImage
:
previewImage
,
getSystemInfo
:
getSystemInfo
,
getSystemInfoSync
:
getSystemInfoSync
getSystemInfoSync
:
getSystemInfoSync
,
createCanvasContext
:
createCanvasContext
});
var
index
=
initUni
(
shims
,
protocols
);
...
...
packages/uni-quickapp-webview/dist/uni.mp.esm.js
浏览文件 @
7325d4b3
...
...
@@ -52,28 +52,6 @@ const MP_METHODS = [
'
selectAllComponents
'
,
'
selectComponent
'
];
function
hasHook
(
name
)
{
const
hooks
=
this
.
$
[
name
];
if
(
hooks
&&
hooks
.
length
)
{
return
true
;
}
return
false
;
}
function
callHook
(
name
,
args
)
{
if
(
name
===
'
mounted
'
)
{
callHook
.
call
(
this
,
'
bm
'
);
// beforeMount
this
.
$
.
isMounted
=
true
;
name
=
'
m
'
;
}
const
hooks
=
this
.
$
[
name
];
let
ret
;
if
(
hooks
)
{
for
(
let
i
=
0
;
i
<
hooks
.
length
;
i
++
)
{
ret
=
hooks
[
i
](
args
);
}
}
return
ret
;
}
function
createEmitFn
(
oldEmit
,
ctx
)
{
return
function
emit
(
event
,
...
args
)
{
if
(
ctx
.
$scope
&&
event
)
{
...
...
@@ -82,9 +60,6 @@ function createEmitFn(oldEmit, ctx) {
return
oldEmit
.
apply
(
this
,
[
event
,
...
args
]);
};
}
function
set
(
target
,
key
,
val
)
{
return
(
target
[
key
]
=
val
);
}
function
initBaseInstance
(
instance
,
options
)
{
const
ctx
=
instance
.
ctx
;
// mp
...
...
@@ -93,7 +68,9 @@ function initBaseInstance(instance, options) {
ctx
.
$scope
=
options
.
mpInstance
;
// TODO @deprecated
ctx
.
$mp
=
{};
if
(
__VUE_OPTIONS_API__
)
{
ctx
.
_self
=
{};
}
// $vm
ctx
.
$scope
.
$vm
=
instance
.
proxy
;
// slots
...
...
@@ -105,15 +82,8 @@ function initBaseInstance(instance, options) {
});
}
}
if
(
__VUE_OPTIONS_API__
)
{
// $set
ctx
.
$set
=
set
;
}
// $emit
instance
.
emit
=
createEmitFn
(
instance
.
emit
,
ctx
);
// $callHook
ctx
.
$hasHook
=
hasHook
;
ctx
.
$callHook
=
callHook
;
}
function
initComponentInstance
(
instance
,
options
)
{
initBaseInstance
(
instance
,
options
);
...
...
@@ -207,7 +177,7 @@ function parseApp(instance, parseAppOptions) {
$vm
:
instance
,
onLaunch
(
options
)
{
const
ctx
=
internalInstance
.
ctx
;
if
(
this
.
$vm
&&
ctx
.
$
callHook
)
{
if
(
this
.
$vm
&&
ctx
.
$
scope
)
{
// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
return
;
}
...
...
@@ -238,6 +208,26 @@ function initCreateApp(parseAppOptions) {
};
}
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
const
res
=
obj
?
Object
.
keys
(
obj
)
.
map
(
key
=>
{
let
val
=
obj
[
key
];
if
(
typeof
val
===
undefined
||
val
===
null
)
{
val
=
''
;
}
else
if
(
isPlainObject
(
val
))
{
val
=
JSON
.
stringify
(
val
);
}
return
encodeStr
(
key
)
+
'
=
'
+
encodeStr
(
val
);
})
.
filter
(
x
=>
x
.
length
>
0
)
.
join
(
'
&
'
)
:
null
;
return
res
?
`?
${
res
}
`
:
''
;
}
function
initBehavior
(
options
)
{
return
Behavior
(
options
);
}
...
...
@@ -772,6 +762,13 @@ function parsePage(vueOptions, parseOptions) {
initLifetimes
});
const
methods
=
miniProgramPageOptions
.
methods
;
methods
.
onLoad
=
function
(
query
)
{
this
.
options
=
query
;
this
.
$page
=
{
fullPath
:
'
/
'
+
this
.
route
+
stringifyQuery
(
query
)
};
return
this
.
$vm
&&
this
.
$vm
.
$callHook
(
'
onLoad
'
,
query
);
};
initHooks
(
methods
,
PAGE_HOOKS
);
initUnknownHooks
(
methods
,
vueOptions
);
parse
&&
parse
(
miniProgramPageOptions
,
{
handleLink
});
...
...
@@ -969,7 +966,7 @@ function initLifetimes$1(lifetimesOptions) {
const
mocks
=
[
'
nodeId
'
,
'
componentName
'
,
'
_componentId
'
,
'
uniquePrefix
'
];
function
isPage
(
mpInstance
)
{
return
!
mpInstance
.
ownerId
;
return
!
hasOwn
(
mpInstance
,
'
ownerId
'
)
;
}
function
initRelation
(
mpInstance
)
{
...
...
packages/vue-cli-plugin-uni/generator.js
浏览文件 @
7325d4b3
...
...
@@ -58,7 +58,7 @@ module.exports = (api, options, rootOptions) => {
'
@dcloudio/uni-quickapp-native
'
:
version
,
'
@dcloudio/uni-quickapp-webview
'
:
version
,
'
@dcloudio/uni-stat
'
:
version
,
'
@vue/shared
'
:
'
^3.0.0
-rc.4
'
,
// TODO
'
@vue/shared
'
:
'
^3.0.0
'
,
flyio
:
'
^0.6.2
'
,
vuex
:
'
^3.2.0
'
},
...
...
src/platforms/mp-baidu/runtime/wrapper/page-parser.js
浏览文件 @
7325d4b3
...
...
@@ -29,6 +29,11 @@ export default function parsePage (vuePageOptions) {
initRelation
})
const
onInit
=
(
vuePageOptions
.
default
||
vuePageOptions
).
onInit
if
(
onInit
)
{
pageOptions
.
methods
.
onInit
=
onInit
}
// 纠正百度小程序生命周期methods:onShow在methods:onLoad之前触发的问题
pageOptions
.
methods
.
onShow
=
function
onShow
()
{
if
(
this
.
$vm
&&
this
.
$vm
.
$mp
.
query
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录