mirror of
https://github.com/motajs/template.git
synced 2026-11-16 00:44:43 +08:00
feat: container-custom 也添加 bindings 参数
This commit is contained in:
1 parent
49124fdc29
commit
ca90a221a7
3 files changed
+11
-2
No files matched your search
@@ -94,6 +94,8 @@ export interface ConatinerCustomProps extends ContainerProps {
|
||||
render?: CustomContainerRenderFn;
|
||||
/** 自定义容器事件传递函数 */
|
||||
propagate?: CustomContainerPropagateFn;
|
||||
/** 更新绑定,当数组中的任意一项更新时将会自动更新此元素的渲染 */
|
||||
bindings?: readonly unknown[];
|
||||
}
|
||||
|
||||
export interface GL2Props extends BaseProps {}
|
||||
|
||||
@@ -188,6 +188,11 @@ export class CustomContainer extends Container {
|
||||
this.setPropagateFn(nextValue);
|
||||
return true;
|
||||
}
|
||||
case 'bindings': {
|
||||
if (!this.assertType(nextValue, Array, key)) return false;
|
||||
this.update();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.handleProps(key, prevValue, nextValue);
|
||||
}
|
||||
|
||||
@@ -32,14 +32,16 @@ export class CustomRenderItem extends RenderItem {
|
||||
nextValue: any
|
||||
): boolean {
|
||||
switch (key) {
|
||||
case 'render':
|
||||
case 'render': {
|
||||
if (!this.assertType(nextValue, 'function', key)) return false;
|
||||
this.setRenderFn(nextValue);
|
||||
return true;
|
||||
case 'bindings':
|
||||
}
|
||||
case 'bindings': {
|
||||
if (!this.assertType(nextValue, Array, key)) return false;
|
||||
this.update();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user