UNPKG

@morjs/runtime-mini

Version:

mor runtime for miniprogram

34 lines (33 loc) 1.38 kB
/** * 自定义组件扩展 * 微信参考文档: https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/extend.html * 支付宝参考文档: https://opendocs.alipay.com/mini/05bdpv?pathHash=4a676f9c */ export declare type DefinitionFilter = <T extends Record<string, any>>( /** 使用该 behavior/mixin 的 component - behavior/mixin 的定义对象 */ defFields: T, /** 该 behavior/mixin 所使用的 behavior/mixin 的 definitionFilter 函数列表 */ definitionFilterArr?: DefinitionFilter[]) => void; export interface BehaviorOrMixinOptions { definitionFilter?: DefinitionFilter; behaviors?: BehaviorOrMixinOptions[]; [k: string]: any; } /** * Behavior 构造函数实现 * @param options - Behavior 选项 */ export declare function Behavior(options: BehaviorOrMixinOptions): Omit<BehaviorOrMixinOptions, 'definitionFilter'>; /** * Mixin 构造函数实现 * @param options - Mixin 选项 */ export declare function Mixin(options: BehaviorOrMixinOptions): Omit<BehaviorOrMixinOptions, 'definitionFilter'>; /** * 注入 hasBehavior 方法支持 */ export declare function injectHasBehaviorSupport(options: Record<string, any>, behaviors?: BehaviorOrMixinOptions[]): void; /** * 注入 hasMixin 方法支持 */ export declare function injectHasMixinSupport(options: Record<string, any>, mixins?: BehaviorOrMixinOptions[]): void;