Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qianlong66
uni-app
提交
ea98576c
U
uni-app
项目概览
qianlong66
/
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,发现更多精彩内容 >>
提交
ea98576c
编写于
4月 22, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore(mp): rename initHook
上级
ff46f17a
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
52 addition
and
52 deletion
+52
-52
packages/uni-mp-baidu/dist/uni.mp.esm.js
packages/uni-mp-baidu/dist/uni.mp.esm.js
+7
-7
packages/uni-mp-core/src/runtime/polyfill.ts
packages/uni-mp-core/src/runtime/polyfill.ts
+3
-3
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
+7
-7
packages/uni-mp-lark/dist/uni.mp.esm.js
packages/uni-mp-lark/dist/uni.mp.esm.js
+7
-7
packages/uni-mp-qq/dist/uni.mp.esm.js
packages/uni-mp-qq/dist/uni.mp.esm.js
+7
-7
packages/uni-mp-toutiao/dist/uni.mp.esm.js
packages/uni-mp-toutiao/dist/uni.mp.esm.js
+7
-7
packages/uni-mp-weixin/dist/uni.mp.esm.js
packages/uni-mp-weixin/dist/uni.mp.esm.js
+7
-7
packages/uni-quickapp-webview/dist/uni.mp.esm.js
packages/uni-quickapp-webview/dist/uni.mp.esm.js
+7
-7
未找到文件。
packages/uni-mp-baidu/dist/uni.mp.esm.js
浏览文件 @
ea98576c
...
@@ -286,7 +286,7 @@ function findHooks(vueOptions, hooks = new Set()) {
...
@@ -286,7 +286,7 @@ function findHooks(vueOptions, hooks = new Set()) {
}
}
return
hooks
;
return
hooks
;
}
}
function
initHook
$1
(
mpOptions
,
hook
,
excludes
)
{
function
initHook
(
mpOptions
,
hook
,
excludes
)
{
if
(
excludes
.
indexOf
(
hook
)
===
-
1
&&
!
hasOwn
(
mpOptions
,
hook
))
{
if
(
excludes
.
indexOf
(
hook
)
===
-
1
&&
!
hasOwn
(
mpOptions
,
hook
))
{
mpOptions
[
hook
]
=
function
(
args
)
{
mpOptions
[
hook
]
=
function
(
args
)
{
return
this
.
$vm
&&
this
.
$vm
.
$callHook
(
hook
,
args
);
return
this
.
$vm
&&
this
.
$vm
.
$callHook
(
hook
,
args
);
...
@@ -295,10 +295,10 @@ function initHook$1(mpOptions, hook, excludes) {
...
@@ -295,10 +295,10 @@ function initHook$1(mpOptions, hook, excludes) {
}
}
const
EXCLUDE_HOOKS
=
[
ON_READY
];
const
EXCLUDE_HOOKS
=
[
ON_READY
];
function
initHooks
(
mpOptions
,
hooks
,
excludes
=
EXCLUDE_HOOKS
)
{
function
initHooks
(
mpOptions
,
hooks
,
excludes
=
EXCLUDE_HOOKS
)
{
hooks
.
forEach
((
hook
)
=>
initHook
$1
(
mpOptions
,
hook
,
excludes
));
hooks
.
forEach
((
hook
)
=>
initHook
(
mpOptions
,
hook
,
excludes
));
}
}
function
initUnknownHooks
(
mpOptions
,
vueOptions
,
excludes
=
EXCLUDE_HOOKS
)
{
function
initUnknownHooks
(
mpOptions
,
vueOptions
,
excludes
=
EXCLUDE_HOOKS
)
{
findHooks
(
vueOptions
).
forEach
((
hook
)
=>
initHook
$1
(
mpOptions
,
hook
,
excludes
));
findHooks
(
vueOptions
).
forEach
((
hook
)
=>
initHook
(
mpOptions
,
hook
,
excludes
));
}
}
function
initRuntimeHooks
(
mpOptions
,
runtimeHooks
)
{
function
initRuntimeHooks
(
mpOptions
,
runtimeHooks
)
{
if
(
!
runtimeHooks
)
{
if
(
!
runtimeHooks
)
{
...
@@ -307,7 +307,7 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
...
@@ -307,7 +307,7 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
const
hooks
=
Object
.
keys
(
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
);
const
hooks
=
Object
.
keys
(
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
);
hooks
.
forEach
((
hook
)
=>
{
hooks
.
forEach
((
hook
)
=>
{
if
(
runtimeHooks
&
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
[
hook
])
{
if
(
runtimeHooks
&
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
[
hook
])
{
initHook
$1
(
mpOptions
,
hook
,
[]);
initHook
(
mpOptions
,
hook
,
[]);
}
}
});
});
}
}
...
@@ -924,7 +924,7 @@ function initTriggerEvent(mpInstance) {
...
@@ -924,7 +924,7 @@ function initTriggerEvent(mpInstance) {
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customizeEvent
(
event
),
...
args
]);
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customizeEvent
(
event
),
...
args
]);
};
};
}
}
function
initHook
(
name
,
options
,
isComponent
)
{
function
init
MiniProgram
Hook
(
name
,
options
,
isComponent
)
{
const
oldHook
=
options
[
name
];
const
oldHook
=
options
[
name
];
if
(
!
oldHook
)
{
if
(
!
oldHook
)
{
options
[
name
]
=
function
()
{
options
[
name
]
=
function
()
{
...
@@ -939,14 +939,14 @@ function initHook(name, options, isComponent) {
...
@@ -939,14 +939,14 @@ function initHook(name, options, isComponent) {
}
}
}
}
Page
=
function
(
options
)
{
Page
=
function
(
options
)
{
initHook
(
ON_LOAD
,
options
);
init
MiniProgram
Hook
(
ON_LOAD
,
options
);
return
MPPage
(
options
);
return
MPPage
(
options
);
};
};
{
{
Page
.
after
=
MPPage
.
after
;
Page
.
after
=
MPPage
.
after
;
}
}
Component
=
function
(
options
)
{
Component
=
function
(
options
)
{
initHook
(
'
created
'
,
options
);
init
MiniProgram
Hook
(
'
created
'
,
options
);
// 小程序组件
// 小程序组件
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
;
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
;
if
(
!
isVueComponent
)
{
if
(
!
isVueComponent
)
{
...
...
packages/uni-mp-core/src/runtime/polyfill.ts
浏览文件 @
ea98576c
...
@@ -13,7 +13,7 @@ function initTriggerEvent(mpInstance: MPComponentInstance) {
...
@@ -13,7 +13,7 @@ function initTriggerEvent(mpInstance: MPComponentInstance) {
}
}
}
}
function
initHook
(
function
init
MiniProgram
Hook
(
name
:
'
onLoad
'
|
'
created
'
,
name
:
'
onLoad
'
|
'
created
'
,
options
:
Record
<
string
,
any
>
,
options
:
Record
<
string
,
any
>
,
isComponent
?:
boolean
isComponent
?:
boolean
...
@@ -39,7 +39,7 @@ function initHook(
...
@@ -39,7 +39,7 @@ function initHook(
}
}
Page
=
function
(
options
)
{
Page
=
function
(
options
)
{
initHook
(
ON_LOAD
,
options
)
init
MiniProgram
Hook
(
ON_LOAD
,
options
)
return
MPPage
(
options
)
return
MPPage
(
options
)
}
}
if
(
__PLATFORM__
===
'
mp-baidu
'
)
{
if
(
__PLATFORM__
===
'
mp-baidu
'
)
{
...
@@ -48,7 +48,7 @@ if (__PLATFORM__ === 'mp-baidu') {
...
@@ -48,7 +48,7 @@ if (__PLATFORM__ === 'mp-baidu') {
;(
Page
as
any
).
after
=
(
MPPage
as
any
).
after
;(
Page
as
any
).
after
=
(
MPPage
as
any
).
after
}
}
Component
=
function
(
options
)
{
Component
=
function
(
options
)
{
initHook
(
'
created
'
,
options
,
true
)
init
MiniProgram
Hook
(
'
created
'
,
options
,
true
)
// 小程序组件
// 小程序组件
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
if
(
!
isVueComponent
)
{
if
(
!
isVueComponent
)
{
...
...
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
浏览文件 @
ea98576c
...
@@ -284,7 +284,7 @@ function findHooks(vueOptions, hooks = new Set()) {
...
@@ -284,7 +284,7 @@ function findHooks(vueOptions, hooks = new Set()) {
}
}
return
hooks
;
return
hooks
;
}
}
function
initHook
$1
(
mpOptions
,
hook
,
excludes
)
{
function
initHook
(
mpOptions
,
hook
,
excludes
)
{
if
(
excludes
.
indexOf
(
hook
)
===
-
1
&&
!
hasOwn
(
mpOptions
,
hook
))
{
if
(
excludes
.
indexOf
(
hook
)
===
-
1
&&
!
hasOwn
(
mpOptions
,
hook
))
{
mpOptions
[
hook
]
=
function
(
args
)
{
mpOptions
[
hook
]
=
function
(
args
)
{
return
this
.
$vm
&&
this
.
$vm
.
$callHook
(
hook
,
args
);
return
this
.
$vm
&&
this
.
$vm
.
$callHook
(
hook
,
args
);
...
@@ -293,10 +293,10 @@ function initHook$1(mpOptions, hook, excludes) {
...
@@ -293,10 +293,10 @@ function initHook$1(mpOptions, hook, excludes) {
}
}
const
EXCLUDE_HOOKS
=
[
ON_READY
];
const
EXCLUDE_HOOKS
=
[
ON_READY
];
function
initHooks
(
mpOptions
,
hooks
,
excludes
=
EXCLUDE_HOOKS
)
{
function
initHooks
(
mpOptions
,
hooks
,
excludes
=
EXCLUDE_HOOKS
)
{
hooks
.
forEach
((
hook
)
=>
initHook
$1
(
mpOptions
,
hook
,
excludes
));
hooks
.
forEach
((
hook
)
=>
initHook
(
mpOptions
,
hook
,
excludes
));
}
}
function
initUnknownHooks
(
mpOptions
,
vueOptions
,
excludes
=
EXCLUDE_HOOKS
)
{
function
initUnknownHooks
(
mpOptions
,
vueOptions
,
excludes
=
EXCLUDE_HOOKS
)
{
findHooks
(
vueOptions
).
forEach
((
hook
)
=>
initHook
$1
(
mpOptions
,
hook
,
excludes
));
findHooks
(
vueOptions
).
forEach
((
hook
)
=>
initHook
(
mpOptions
,
hook
,
excludes
));
}
}
function
initRuntimeHooks
(
mpOptions
,
runtimeHooks
)
{
function
initRuntimeHooks
(
mpOptions
,
runtimeHooks
)
{
if
(
!
runtimeHooks
)
{
if
(
!
runtimeHooks
)
{
...
@@ -305,7 +305,7 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
...
@@ -305,7 +305,7 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
const
hooks
=
Object
.
keys
(
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
);
const
hooks
=
Object
.
keys
(
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
);
hooks
.
forEach
((
hook
)
=>
{
hooks
.
forEach
((
hook
)
=>
{
if
(
runtimeHooks
&
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
[
hook
])
{
if
(
runtimeHooks
&
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
[
hook
])
{
initHook
$1
(
mpOptions
,
hook
,
[]);
initHook
(
mpOptions
,
hook
,
[]);
}
}
});
});
}
}
...
@@ -911,7 +911,7 @@ function initTriggerEvent(mpInstance) {
...
@@ -911,7 +911,7 @@ function initTriggerEvent(mpInstance) {
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customizeEvent
(
event
),
...
args
]);
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customizeEvent
(
event
),
...
args
]);
};
};
}
}
function
initHook
(
name
,
options
,
isComponent
)
{
function
init
MiniProgram
Hook
(
name
,
options
,
isComponent
)
{
const
oldHook
=
options
[
name
];
const
oldHook
=
options
[
name
];
if
(
!
oldHook
)
{
if
(
!
oldHook
)
{
options
[
name
]
=
function
()
{
options
[
name
]
=
function
()
{
...
@@ -926,11 +926,11 @@ function initHook(name, options, isComponent) {
...
@@ -926,11 +926,11 @@ function initHook(name, options, isComponent) {
}
}
}
}
Page
=
function
(
options
)
{
Page
=
function
(
options
)
{
initHook
(
ON_LOAD
,
options
);
init
MiniProgram
Hook
(
ON_LOAD
,
options
);
return
MPPage
(
options
);
return
MPPage
(
options
);
};
};
Component
=
function
(
options
)
{
Component
=
function
(
options
)
{
initHook
(
'
created
'
,
options
);
init
MiniProgram
Hook
(
'
created
'
,
options
);
// 小程序组件
// 小程序组件
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
;
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
;
if
(
!
isVueComponent
)
{
if
(
!
isVueComponent
)
{
...
...
packages/uni-mp-lark/dist/uni.mp.esm.js
浏览文件 @
ea98576c
...
@@ -280,7 +280,7 @@ function findHooks(vueOptions, hooks = new Set()) {
...
@@ -280,7 +280,7 @@ function findHooks(vueOptions, hooks = new Set()) {
}
}
return
hooks
;
return
hooks
;
}
}
function
initHook
$1
(
mpOptions
,
hook
,
excludes
)
{
function
initHook
(
mpOptions
,
hook
,
excludes
)
{
if
(
excludes
.
indexOf
(
hook
)
===
-
1
&&
!
hasOwn
(
mpOptions
,
hook
))
{
if
(
excludes
.
indexOf
(
hook
)
===
-
1
&&
!
hasOwn
(
mpOptions
,
hook
))
{
mpOptions
[
hook
]
=
function
(
args
)
{
mpOptions
[
hook
]
=
function
(
args
)
{
if
(
hook
===
'
onError
'
)
{
if
(
hook
===
'
onError
'
)
{
...
@@ -292,10 +292,10 @@ function initHook$1(mpOptions, hook, excludes) {
...
@@ -292,10 +292,10 @@ function initHook$1(mpOptions, hook, excludes) {
}
}
const
EXCLUDE_HOOKS
=
[
ON_READY
];
const
EXCLUDE_HOOKS
=
[
ON_READY
];
function
initHooks
(
mpOptions
,
hooks
,
excludes
=
EXCLUDE_HOOKS
)
{
function
initHooks
(
mpOptions
,
hooks
,
excludes
=
EXCLUDE_HOOKS
)
{
hooks
.
forEach
((
hook
)
=>
initHook
$1
(
mpOptions
,
hook
,
excludes
));
hooks
.
forEach
((
hook
)
=>
initHook
(
mpOptions
,
hook
,
excludes
));
}
}
function
initUnknownHooks
(
mpOptions
,
vueOptions
,
excludes
=
EXCLUDE_HOOKS
)
{
function
initUnknownHooks
(
mpOptions
,
vueOptions
,
excludes
=
EXCLUDE_HOOKS
)
{
findHooks
(
vueOptions
).
forEach
((
hook
)
=>
initHook
$1
(
mpOptions
,
hook
,
excludes
));
findHooks
(
vueOptions
).
forEach
((
hook
)
=>
initHook
(
mpOptions
,
hook
,
excludes
));
}
}
function
initRuntimeHooks
(
mpOptions
,
runtimeHooks
)
{
function
initRuntimeHooks
(
mpOptions
,
runtimeHooks
)
{
if
(
!
runtimeHooks
)
{
if
(
!
runtimeHooks
)
{
...
@@ -304,7 +304,7 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
...
@@ -304,7 +304,7 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
const
hooks
=
Object
.
keys
(
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
);
const
hooks
=
Object
.
keys
(
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
);
hooks
.
forEach
((
hook
)
=>
{
hooks
.
forEach
((
hook
)
=>
{
if
(
runtimeHooks
&
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
[
hook
])
{
if
(
runtimeHooks
&
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
[
hook
])
{
initHook
$1
(
mpOptions
,
hook
,
[]);
initHook
(
mpOptions
,
hook
,
[]);
}
}
});
});
}
}
...
@@ -845,7 +845,7 @@ function initTriggerEvent(mpInstance) {
...
@@ -845,7 +845,7 @@ function initTriggerEvent(mpInstance) {
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customizeEvent
(
event
),
...
args
]);
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customizeEvent
(
event
),
...
args
]);
};
};
}
}
function
initHook
(
name
,
options
,
isComponent
)
{
function
init
MiniProgram
Hook
(
name
,
options
,
isComponent
)
{
if
(
isComponent
)
{
if
(
isComponent
)
{
// fix by Lxh 字节自定义组件Component构造器文档上写有created,但是实测只触发了lifetimes上的created
// fix by Lxh 字节自定义组件Component构造器文档上写有created,但是实测只触发了lifetimes上的created
options
=
options
.
lifetimes
;
options
=
options
.
lifetimes
;
...
@@ -864,11 +864,11 @@ function initHook(name, options, isComponent) {
...
@@ -864,11 +864,11 @@ function initHook(name, options, isComponent) {
}
}
}
}
Page
=
function
(
options
)
{
Page
=
function
(
options
)
{
initHook
(
ON_LOAD
,
options
);
init
MiniProgram
Hook
(
ON_LOAD
,
options
);
return
MPPage
(
options
);
return
MPPage
(
options
);
};
};
Component
=
function
(
options
)
{
Component
=
function
(
options
)
{
initHook
(
'
created
'
,
options
,
true
);
init
MiniProgram
Hook
(
'
created
'
,
options
,
true
);
// 小程序组件
// 小程序组件
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
;
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
;
if
(
!
isVueComponent
)
{
if
(
!
isVueComponent
)
{
...
...
packages/uni-mp-qq/dist/uni.mp.esm.js
浏览文件 @
ea98576c
...
@@ -280,7 +280,7 @@ function findHooks(vueOptions, hooks = new Set()) {
...
@@ -280,7 +280,7 @@ function findHooks(vueOptions, hooks = new Set()) {
}
}
return
hooks
;
return
hooks
;
}
}
function
initHook
$1
(
mpOptions
,
hook
,
excludes
)
{
function
initHook
(
mpOptions
,
hook
,
excludes
)
{
if
(
excludes
.
indexOf
(
hook
)
===
-
1
&&
!
hasOwn
(
mpOptions
,
hook
))
{
if
(
excludes
.
indexOf
(
hook
)
===
-
1
&&
!
hasOwn
(
mpOptions
,
hook
))
{
mpOptions
[
hook
]
=
function
(
args
)
{
mpOptions
[
hook
]
=
function
(
args
)
{
return
this
.
$vm
&&
this
.
$vm
.
$callHook
(
hook
,
args
);
return
this
.
$vm
&&
this
.
$vm
.
$callHook
(
hook
,
args
);
...
@@ -289,10 +289,10 @@ function initHook$1(mpOptions, hook, excludes) {
...
@@ -289,10 +289,10 @@ function initHook$1(mpOptions, hook, excludes) {
}
}
const
EXCLUDE_HOOKS
=
[
ON_READY
];
const
EXCLUDE_HOOKS
=
[
ON_READY
];
function
initHooks
(
mpOptions
,
hooks
,
excludes
=
EXCLUDE_HOOKS
)
{
function
initHooks
(
mpOptions
,
hooks
,
excludes
=
EXCLUDE_HOOKS
)
{
hooks
.
forEach
((
hook
)
=>
initHook
$1
(
mpOptions
,
hook
,
excludes
));
hooks
.
forEach
((
hook
)
=>
initHook
(
mpOptions
,
hook
,
excludes
));
}
}
function
initUnknownHooks
(
mpOptions
,
vueOptions
,
excludes
=
EXCLUDE_HOOKS
)
{
function
initUnknownHooks
(
mpOptions
,
vueOptions
,
excludes
=
EXCLUDE_HOOKS
)
{
findHooks
(
vueOptions
).
forEach
((
hook
)
=>
initHook
$1
(
mpOptions
,
hook
,
excludes
));
findHooks
(
vueOptions
).
forEach
((
hook
)
=>
initHook
(
mpOptions
,
hook
,
excludes
));
}
}
function
initRuntimeHooks
(
mpOptions
,
runtimeHooks
)
{
function
initRuntimeHooks
(
mpOptions
,
runtimeHooks
)
{
if
(
!
runtimeHooks
)
{
if
(
!
runtimeHooks
)
{
...
@@ -301,7 +301,7 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
...
@@ -301,7 +301,7 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
const
hooks
=
Object
.
keys
(
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
);
const
hooks
=
Object
.
keys
(
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
);
hooks
.
forEach
((
hook
)
=>
{
hooks
.
forEach
((
hook
)
=>
{
if
(
runtimeHooks
&
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
[
hook
])
{
if
(
runtimeHooks
&
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
[
hook
])
{
initHook
$1
(
mpOptions
,
hook
,
[]);
initHook
(
mpOptions
,
hook
,
[]);
}
}
});
});
}
}
...
@@ -843,7 +843,7 @@ function initTriggerEvent(mpInstance) {
...
@@ -843,7 +843,7 @@ function initTriggerEvent(mpInstance) {
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customizeEvent
(
event
),
...
args
]);
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customizeEvent
(
event
),
...
args
]);
};
};
}
}
function
initHook
(
name
,
options
,
isComponent
)
{
function
init
MiniProgram
Hook
(
name
,
options
,
isComponent
)
{
const
oldHook
=
options
[
name
];
const
oldHook
=
options
[
name
];
if
(
!
oldHook
)
{
if
(
!
oldHook
)
{
options
[
name
]
=
function
()
{
options
[
name
]
=
function
()
{
...
@@ -858,11 +858,11 @@ function initHook(name, options, isComponent) {
...
@@ -858,11 +858,11 @@ function initHook(name, options, isComponent) {
}
}
}
}
Page
=
function
(
options
)
{
Page
=
function
(
options
)
{
initHook
(
ON_LOAD
,
options
);
init
MiniProgram
Hook
(
ON_LOAD
,
options
);
return
MPPage
(
options
);
return
MPPage
(
options
);
};
};
Component
=
function
(
options
)
{
Component
=
function
(
options
)
{
initHook
(
'
created
'
,
options
);
init
MiniProgram
Hook
(
'
created
'
,
options
);
// 小程序组件
// 小程序组件
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
;
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
;
if
(
!
isVueComponent
)
{
if
(
!
isVueComponent
)
{
...
...
packages/uni-mp-toutiao/dist/uni.mp.esm.js
浏览文件 @
ea98576c
...
@@ -280,7 +280,7 @@ function findHooks(vueOptions, hooks = new Set()) {
...
@@ -280,7 +280,7 @@ function findHooks(vueOptions, hooks = new Set()) {
}
}
return
hooks
;
return
hooks
;
}
}
function
initHook
$1
(
mpOptions
,
hook
,
excludes
)
{
function
initHook
(
mpOptions
,
hook
,
excludes
)
{
if
(
excludes
.
indexOf
(
hook
)
===
-
1
&&
!
hasOwn
(
mpOptions
,
hook
))
{
if
(
excludes
.
indexOf
(
hook
)
===
-
1
&&
!
hasOwn
(
mpOptions
,
hook
))
{
mpOptions
[
hook
]
=
function
(
args
)
{
mpOptions
[
hook
]
=
function
(
args
)
{
if
(
hook
===
'
onError
'
)
{
if
(
hook
===
'
onError
'
)
{
...
@@ -292,10 +292,10 @@ function initHook$1(mpOptions, hook, excludes) {
...
@@ -292,10 +292,10 @@ function initHook$1(mpOptions, hook, excludes) {
}
}
const
EXCLUDE_HOOKS
=
[
ON_READY
];
const
EXCLUDE_HOOKS
=
[
ON_READY
];
function
initHooks
(
mpOptions
,
hooks
,
excludes
=
EXCLUDE_HOOKS
)
{
function
initHooks
(
mpOptions
,
hooks
,
excludes
=
EXCLUDE_HOOKS
)
{
hooks
.
forEach
((
hook
)
=>
initHook
$1
(
mpOptions
,
hook
,
excludes
));
hooks
.
forEach
((
hook
)
=>
initHook
(
mpOptions
,
hook
,
excludes
));
}
}
function
initUnknownHooks
(
mpOptions
,
vueOptions
,
excludes
=
EXCLUDE_HOOKS
)
{
function
initUnknownHooks
(
mpOptions
,
vueOptions
,
excludes
=
EXCLUDE_HOOKS
)
{
findHooks
(
vueOptions
).
forEach
((
hook
)
=>
initHook
$1
(
mpOptions
,
hook
,
excludes
));
findHooks
(
vueOptions
).
forEach
((
hook
)
=>
initHook
(
mpOptions
,
hook
,
excludes
));
}
}
function
initRuntimeHooks
(
mpOptions
,
runtimeHooks
)
{
function
initRuntimeHooks
(
mpOptions
,
runtimeHooks
)
{
if
(
!
runtimeHooks
)
{
if
(
!
runtimeHooks
)
{
...
@@ -304,7 +304,7 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
...
@@ -304,7 +304,7 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
const
hooks
=
Object
.
keys
(
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
);
const
hooks
=
Object
.
keys
(
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
);
hooks
.
forEach
((
hook
)
=>
{
hooks
.
forEach
((
hook
)
=>
{
if
(
runtimeHooks
&
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
[
hook
])
{
if
(
runtimeHooks
&
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
[
hook
])
{
initHook
$1
(
mpOptions
,
hook
,
[]);
initHook
(
mpOptions
,
hook
,
[]);
}
}
});
});
}
}
...
@@ -846,7 +846,7 @@ function initTriggerEvent(mpInstance) {
...
@@ -846,7 +846,7 @@ function initTriggerEvent(mpInstance) {
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customizeEvent
(
event
),
...
args
]);
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customizeEvent
(
event
),
...
args
]);
};
};
}
}
function
initHook
(
name
,
options
,
isComponent
)
{
function
init
MiniProgram
Hook
(
name
,
options
,
isComponent
)
{
if
(
isComponent
)
{
if
(
isComponent
)
{
// fix by Lxh 字节自定义组件Component构造器文档上写有created,但是实测只触发了lifetimes上的created
// fix by Lxh 字节自定义组件Component构造器文档上写有created,但是实测只触发了lifetimes上的created
options
=
options
.
lifetimes
;
options
=
options
.
lifetimes
;
...
@@ -865,11 +865,11 @@ function initHook(name, options, isComponent) {
...
@@ -865,11 +865,11 @@ function initHook(name, options, isComponent) {
}
}
}
}
Page
=
function
(
options
)
{
Page
=
function
(
options
)
{
initHook
(
ON_LOAD
,
options
);
init
MiniProgram
Hook
(
ON_LOAD
,
options
);
return
MPPage
(
options
);
return
MPPage
(
options
);
};
};
Component
=
function
(
options
)
{
Component
=
function
(
options
)
{
initHook
(
'
created
'
,
options
,
true
);
init
MiniProgram
Hook
(
'
created
'
,
options
,
true
);
// 小程序组件
// 小程序组件
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
;
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
;
if
(
!
isVueComponent
)
{
if
(
!
isVueComponent
)
{
...
...
packages/uni-mp-weixin/dist/uni.mp.esm.js
浏览文件 @
ea98576c
...
@@ -217,7 +217,7 @@ function findHooks(vueOptions, hooks = new Set()) {
...
@@ -217,7 +217,7 @@ function findHooks(vueOptions, hooks = new Set()) {
}
}
return
hooks
;
return
hooks
;
}
}
function
initHook
$1
(
mpOptions
,
hook
,
excludes
)
{
function
initHook
(
mpOptions
,
hook
,
excludes
)
{
if
(
excludes
.
indexOf
(
hook
)
===
-
1
&&
!
hasOwn
(
mpOptions
,
hook
))
{
if
(
excludes
.
indexOf
(
hook
)
===
-
1
&&
!
hasOwn
(
mpOptions
,
hook
))
{
mpOptions
[
hook
]
=
function
(
args
)
{
mpOptions
[
hook
]
=
function
(
args
)
{
return
this
.
$vm
&&
this
.
$vm
.
$callHook
(
hook
,
args
);
return
this
.
$vm
&&
this
.
$vm
.
$callHook
(
hook
,
args
);
...
@@ -226,10 +226,10 @@ function initHook$1(mpOptions, hook, excludes) {
...
@@ -226,10 +226,10 @@ function initHook$1(mpOptions, hook, excludes) {
}
}
const
EXCLUDE_HOOKS
=
[
ON_READY
];
const
EXCLUDE_HOOKS
=
[
ON_READY
];
function
initHooks
(
mpOptions
,
hooks
,
excludes
=
EXCLUDE_HOOKS
)
{
function
initHooks
(
mpOptions
,
hooks
,
excludes
=
EXCLUDE_HOOKS
)
{
hooks
.
forEach
((
hook
)
=>
initHook
$1
(
mpOptions
,
hook
,
excludes
));
hooks
.
forEach
((
hook
)
=>
initHook
(
mpOptions
,
hook
,
excludes
));
}
}
function
initUnknownHooks
(
mpOptions
,
vueOptions
,
excludes
=
EXCLUDE_HOOKS
)
{
function
initUnknownHooks
(
mpOptions
,
vueOptions
,
excludes
=
EXCLUDE_HOOKS
)
{
findHooks
(
vueOptions
).
forEach
((
hook
)
=>
initHook
$1
(
mpOptions
,
hook
,
excludes
));
findHooks
(
vueOptions
).
forEach
((
hook
)
=>
initHook
(
mpOptions
,
hook
,
excludes
));
}
}
function
initRuntimeHooks
(
mpOptions
,
runtimeHooks
)
{
function
initRuntimeHooks
(
mpOptions
,
runtimeHooks
)
{
if
(
!
runtimeHooks
)
{
if
(
!
runtimeHooks
)
{
...
@@ -238,7 +238,7 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
...
@@ -238,7 +238,7 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
const
hooks
=
Object
.
keys
(
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
);
const
hooks
=
Object
.
keys
(
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
);
hooks
.
forEach
((
hook
)
=>
{
hooks
.
forEach
((
hook
)
=>
{
if
(
runtimeHooks
&
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
[
hook
])
{
if
(
runtimeHooks
&
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
[
hook
])
{
initHook
$1
(
mpOptions
,
hook
,
[]);
initHook
(
mpOptions
,
hook
,
[]);
}
}
});
});
}
}
...
@@ -780,7 +780,7 @@ function initTriggerEvent(mpInstance) {
...
@@ -780,7 +780,7 @@ function initTriggerEvent(mpInstance) {
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customizeEvent
(
event
),
...
args
]);
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customizeEvent
(
event
),
...
args
]);
};
};
}
}
function
initHook
(
name
,
options
,
isComponent
)
{
function
init
MiniProgram
Hook
(
name
,
options
,
isComponent
)
{
const
oldHook
=
options
[
name
];
const
oldHook
=
options
[
name
];
if
(
!
oldHook
)
{
if
(
!
oldHook
)
{
options
[
name
]
=
function
()
{
options
[
name
]
=
function
()
{
...
@@ -795,11 +795,11 @@ function initHook(name, options, isComponent) {
...
@@ -795,11 +795,11 @@ function initHook(name, options, isComponent) {
}
}
}
}
Page
=
function
(
options
)
{
Page
=
function
(
options
)
{
initHook
(
ON_LOAD
,
options
);
init
MiniProgram
Hook
(
ON_LOAD
,
options
);
return
MPPage
(
options
);
return
MPPage
(
options
);
};
};
Component
=
function
(
options
)
{
Component
=
function
(
options
)
{
initHook
(
'
created
'
,
options
);
init
MiniProgram
Hook
(
'
created
'
,
options
);
// 小程序组件
// 小程序组件
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
;
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
;
if
(
!
isVueComponent
)
{
if
(
!
isVueComponent
)
{
...
...
packages/uni-quickapp-webview/dist/uni.mp.esm.js
浏览文件 @
ea98576c
...
@@ -345,7 +345,7 @@ function findHooks(vueOptions, hooks = new Set()) {
...
@@ -345,7 +345,7 @@ function findHooks(vueOptions, hooks = new Set()) {
}
}
return
hooks
;
return
hooks
;
}
}
function
initHook
$1
(
mpOptions
,
hook
,
excludes
)
{
function
initHook
(
mpOptions
,
hook
,
excludes
)
{
if
(
excludes
.
indexOf
(
hook
)
===
-
1
&&
!
hasOwn
(
mpOptions
,
hook
))
{
if
(
excludes
.
indexOf
(
hook
)
===
-
1
&&
!
hasOwn
(
mpOptions
,
hook
))
{
mpOptions
[
hook
]
=
function
(
args
)
{
mpOptions
[
hook
]
=
function
(
args
)
{
return
this
.
$vm
&&
this
.
$vm
.
$callHook
(
hook
,
args
);
return
this
.
$vm
&&
this
.
$vm
.
$callHook
(
hook
,
args
);
...
@@ -354,10 +354,10 @@ function initHook$1(mpOptions, hook, excludes) {
...
@@ -354,10 +354,10 @@ function initHook$1(mpOptions, hook, excludes) {
}
}
const
EXCLUDE_HOOKS
=
[
ON_READY
];
const
EXCLUDE_HOOKS
=
[
ON_READY
];
function
initHooks
(
mpOptions
,
hooks
,
excludes
=
EXCLUDE_HOOKS
)
{
function
initHooks
(
mpOptions
,
hooks
,
excludes
=
EXCLUDE_HOOKS
)
{
hooks
.
forEach
((
hook
)
=>
initHook
$1
(
mpOptions
,
hook
,
excludes
));
hooks
.
forEach
((
hook
)
=>
initHook
(
mpOptions
,
hook
,
excludes
));
}
}
function
initUnknownHooks
(
mpOptions
,
vueOptions
,
excludes
=
EXCLUDE_HOOKS
)
{
function
initUnknownHooks
(
mpOptions
,
vueOptions
,
excludes
=
EXCLUDE_HOOKS
)
{
findHooks
(
vueOptions
).
forEach
((
hook
)
=>
initHook
$1
(
mpOptions
,
hook
,
excludes
));
findHooks
(
vueOptions
).
forEach
((
hook
)
=>
initHook
(
mpOptions
,
hook
,
excludes
));
}
}
function
initRuntimeHooks
(
mpOptions
,
runtimeHooks
)
{
function
initRuntimeHooks
(
mpOptions
,
runtimeHooks
)
{
if
(
!
runtimeHooks
)
{
if
(
!
runtimeHooks
)
{
...
@@ -366,7 +366,7 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
...
@@ -366,7 +366,7 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
const
hooks
=
Object
.
keys
(
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
);
const
hooks
=
Object
.
keys
(
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
);
hooks
.
forEach
((
hook
)
=>
{
hooks
.
forEach
((
hook
)
=>
{
if
(
runtimeHooks
&
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
[
hook
])
{
if
(
runtimeHooks
&
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
[
hook
])
{
initHook
$1
(
mpOptions
,
hook
,
[]);
initHook
(
mpOptions
,
hook
,
[]);
}
}
});
});
}
}
...
@@ -888,7 +888,7 @@ function initTriggerEvent(mpInstance) {
...
@@ -888,7 +888,7 @@ function initTriggerEvent(mpInstance) {
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customizeEvent
(
event
),
...
args
]);
return
oldTriggerEvent
.
apply
(
mpInstance
,
[
customizeEvent
(
event
),
...
args
]);
};
};
}
}
function
initHook
(
name
,
options
,
isComponent
)
{
function
init
MiniProgram
Hook
(
name
,
options
,
isComponent
)
{
const
oldHook
=
options
[
name
];
const
oldHook
=
options
[
name
];
if
(
!
oldHook
)
{
if
(
!
oldHook
)
{
options
[
name
]
=
function
()
{
options
[
name
]
=
function
()
{
...
@@ -903,11 +903,11 @@ function initHook(name, options, isComponent) {
...
@@ -903,11 +903,11 @@ function initHook(name, options, isComponent) {
}
}
}
}
Page
=
function
(
options
)
{
Page
=
function
(
options
)
{
initHook
(
ON_LOAD
,
options
);
init
MiniProgram
Hook
(
ON_LOAD
,
options
);
return
MPPage
(
options
);
return
MPPage
(
options
);
};
};
Component
=
function
(
options
)
{
Component
=
function
(
options
)
{
initHook
(
'
created
'
,
options
);
init
MiniProgram
Hook
(
'
created
'
,
options
);
// 小程序组件
// 小程序组件
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
;
const
isVueComponent
=
options
.
properties
&&
options
.
properties
.
uP
;
if
(
!
isVueComponent
)
{
if
(
!
isVueComponent
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录