fix: click

This commit is contained in:
chenos 2025-06-20 00:02:34 +08:00
parent 8a51539ebd
commit 725a594220
2 changed files with 8 additions and 9 deletions

View File

@ -18,15 +18,7 @@ export class ActionModel extends FlowModel {
children: 'Action', children: 'Action',
}; };
render() { render() {
return ( return <Button {...this.defaultProps} {...this.props} />;
<Button
{...this.defaultProps}
{...this.props}
onClick={(event) => {
this.dispatchEvent('click', { event });
}}
/>
);
} }
} }
@ -57,6 +49,12 @@ ActionModel.registerFlow({
}, },
handler(ctx, params) { handler(ctx, params) {
ctx.model.setProps('children', params.children); ctx.model.setProps('children', params.children);
ctx.model.setProps('onClick', (event) => {
ctx.model.dispatchEvent('click', {
...ctx.extra,
event,
});
});
}, },
}, },
}, },

View File

@ -65,6 +65,7 @@ export class TableModel extends DataBlockModel<S> {
}, },
]} ]}
onModelAdded={async (model: TableColumnModel) => { onModelAdded={async (model: TableColumnModel) => {
model.setSharedContext({ currentBlockModel: this });
await model.applyAutoFlows(); await model.applyAutoFlows();
}} }}
/> />