Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): 修复支付宝 DSL 下 lifetimes 无值可能导致报错的问题 #51

Merged
merged 1 commit into from
Jun 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/core/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,10 @@ function ensureDataAndMethodsAndLifetimes(
): void {
if (!options.methods) options.methods = {}
if (!options.data) options.data = {}
if (!options.lifetimes) options.lifetimes = {}

// 如果 微信DSL
if (sourceType === SOURCE_TYPE.WECHAT) {
if (!options.lifetimes) options.lifetimes = {}

// 微信中 lifetimes 中的优先级高于 options 中的方法
const created = options.lifetimes.created || options.created
delete options.created
Expand Down Expand Up @@ -418,7 +417,10 @@ const WECHAT_COMPONENT_LIFETIMES_METHODS = [
'error'
]

// 支付宝基础库 2.8.5(2022-12-29) 起新增 lifetimes 定义段,支持 created、attached 等组件节点树维度的生命周期函数
/**
* 支付宝基础库 2.8.5 (2022-12-29) 起新增 lifetimes 定义段,
* 支持 created、attached 等组件节点树维度的生命周期函数
*/
const ALIPAY_COMPONENT_LIFETIMES_METHODS = [
'onInit',
'deriveDataFromProps',
Expand Down