Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(popconfirm): 修复base示例多重确认框 #156

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions src/popconfirm/_example/base.tsx
Original file line number Diff line number Diff line change
@@ -1,53 +1,50 @@
import 'tdesign-web-components/popconfirm';
import 'tdesign-web-components/space';
import 'tdesign-web-components/button';
import 'tdesign-web-components/message';

import { Component } from 'omi';
import { Component, signal } from 'omi';
import { MessagePlugin } from 'tdesign-web-components/message/message.tsx';

export default class BasicExample extends Component {
visible = false;
visible = signal(false);

// TODO: Msg调用
commitHandler = () => {
// const msg = MessagePlugin.info('提交中', 0);
const msg = MessagePlugin.info('提交中', 0);
setTimeout(() => {
// MessagePlugin.close(msg);
// MessagePlugin.success('提交成功!');
this.visible = false;
this.update();
MessagePlugin.close(msg);
MessagePlugin.success('提交成功!');
this.visible.value = false;
}, 1000);
};

render() {
return (
<t-space>
<div style={{ display: 'flex', gap: '16px' }}>
<t-popconfirm content={'确认删除订单吗'} cancelBtn={null}>
<t-button theme="primary">删除订单</t-button>
</t-popconfirm>
<t-popconfirm
visible={this.visible}
content={'是否提交审核?(自由控制浮层显示或隐藏)'}
visible={this.visible.value}
content="是否提交审核?(自由控制浮层显示或隐藏)"
confirmBtn={
<t-button size={'small'} onClick={this.commitHandler}>
确定
</t-button>
}
onCancel={() => {
this.visible = false;
this.update();
this.visible.value = false;
}}
>
<t-button
theme="primary"
onClick={() => {
this.visible = true;
this.update();
this.visible.value = true;
}}
>
提交审核
</t-button>
</t-popconfirm>
</t-space>
</div>
);
}
}
2 changes: 1 addition & 1 deletion src/popconfirm/popconfirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class Popconfirm extends Component<PopconfirmProps> {
this.update();
};

installed(): void {
install(): void {
this.pVisible = this.props.visible;
}

Expand Down
Loading