Skip to content

Commit

Permalink
hasMixin 方法 page 和 component 分开声明
Browse files Browse the repository at this point in the history
  • Loading branch information
temu.psc committed Jan 5, 2023
1 parent cebf46d commit 7402686
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
8 changes: 8 additions & 0 deletions packages/global/types/lib.component.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,14 @@ declare namespace MiniProgram.Component {
* @returns undefined | null | 页面 | 自定义组件 | 用户 ref 的 Object
*/
selectComposedParentComponent(): BaseInstance;
/**
* 检查组件是否具有 mixin(须是通过Mixin()创建的mixin实例)。
* @description 若自定义组件注册时传入了ref以指定组件返回值,则可通过hasMixin('ref')检查到
* @version 2.8.2
* @return boolean
* @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
*/
hasMixin(mixin: Mixin.IMixinIdentifier): boolean;
/**
* 获取这个关系所对应的所有关联节点,参见 组件间关系
* @version 2.8.5
Expand Down
1 change: 1 addition & 0 deletions packages/global/types/lib.page.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ declare namespace MiniProgram.Page {
* 检查组件是否具有 mixin(须是通过Mixin()创建的mixin实例)。
* @version 2.8.5
* @return boolean
* @see https://opendocs.alipay.com/mini/framework/page-detail#hasMixin
*/
hasMixin(mixin: Mixin.IMixinIdentifier): boolean;
}
Expand Down
8 changes: 0 additions & 8 deletions packages/global/types/lib.shared.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,6 @@ declare namespace MiniProgram.Shared {
* @see https://opendocs.alipay.com/mini/framework/component_object#%24selectComponent%2F%24selectAllComponents
*/
$selectAllComponents(selector: string): Component.BaseInstance[];
/**
* 检查组件是否具有 mixin(须是通过Mixin()创建的mixin实例)。
* @description 若自定义组件注册时传入了ref以指定组件返回值,则可通过hasMixin('ref')检查到
* @version 2.8.2
* @return boolean
* @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
*/
hasMixin(mixin: Mixin.IMixinIdentifier): boolean;
/**
* 监听 setData 引发界面更新的开销,参见 获取更新性能统计信息
* @version 2.8.5
Expand Down
3 changes: 3 additions & 0 deletions tests/global/component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Component({
},
options: {
observers: true,
externalClasses: true,
lifetimes: true,
relations: true,
},
observers: {
'field1,field2': function(val1, val2) {
Expand Down

0 comments on commit 7402686

Please sign in to comment.