Skip to content

Commit 7402686

Browse files
author
temu.psc
committed
hasMixin 方法 page 和 component 分开声明
1 parent cebf46d commit 7402686

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

packages/global/types/lib.component.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,14 @@ declare namespace MiniProgram.Component {
220220
* @returns undefined | null | 页面 | 自定义组件 | 用户 ref 的 Object
221221
*/
222222
selectComposedParentComponent(): BaseInstance;
223+
/**
224+
* 检查组件是否具有 mixin(须是通过Mixin()创建的mixin实例)。
225+
* @description 若自定义组件注册时传入了ref以指定组件返回值,则可通过hasMixin('ref')检查到
226+
* @version 2.8.2
227+
* @return boolean
228+
* @see https://opendocs.alipay.com/mini/framework/component_object#%E7%BB%84%E4%BB%B6%E5%AE%9E%E4%BE%8B%E6%96%B9%E6%B3%95
229+
*/
230+
hasMixin(mixin: Mixin.IMixinIdentifier): boolean;
223231
/**
224232
* 获取这个关系所对应的所有关联节点,参见 组件间关系
225233
* @version 2.8.5

packages/global/types/lib.page.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ declare namespace MiniProgram.Page {
364364
* 检查组件是否具有 mixin(须是通过Mixin()创建的mixin实例)。
365365
* @version 2.8.5
366366
* @return boolean
367+
* @see https://opendocs.alipay.com/mini/framework/page-detail#hasMixin
367368
*/
368369
hasMixin(mixin: Mixin.IMixinIdentifier): boolean;
369370
}

packages/global/types/lib.shared.d.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,6 @@ declare namespace MiniProgram.Shared {
296296
* @see https://opendocs.alipay.com/mini/framework/component_object#%24selectComponent%2F%24selectAllComponents
297297
*/
298298
$selectAllComponents(selector: string): Component.BaseInstance[];
299-
/**
300-
* 检查组件是否具有 mixin(须是通过Mixin()创建的mixin实例)。
301-
* @description 若自定义组件注册时传入了ref以指定组件返回值,则可通过hasMixin('ref')检查到
302-
* @version 2.8.2
303-
* @return boolean
304-
* @see https://opendocs.alipay.com/mini/framework/component_object#%E7%BB%84%E4%BB%B6%E5%AE%9E%E4%BE%8B%E6%96%B9%E6%B3%95
305-
*/
306-
hasMixin(mixin: Mixin.IMixinIdentifier): boolean;
307299
/**
308300
* 监听 setData 引发界面更新的开销,参见 获取更新性能统计信息
309301
* @version 2.8.5

tests/global/component.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Component({
1313
},
1414
options: {
1515
observers: true,
16+
externalClasses: true,
17+
lifetimes: true,
18+
relations: true,
1619
},
1720
observers: {
1821
'field1,field2': function(val1, val2) {

0 commit comments

Comments
 (0)