3lang3 / react-vant

React mobile UI Components base on Vant
https://react-vant.3lang.dev
MIT License
1.31k stars 186 forks source link

✨ [Feature]: Dialog组件函数调用时如何手动关闭?确定和取消按钮需要自定义 #672

Closed wp1016 closed 11 months ago

wp1016 commented 1 year ago

What is the new or updated feature that you are suggesting?

Dialog组件函数调用时无法手动关闭

Why should this feature be included?

Dialog组件提供关闭方法

3lang3 commented 1 year ago

onConfirm和onClose不行吗

wp1016 commented 1 year ago

Dialog.onClose()吗?

3lang3 commented 11 months ago
Dialog.confirm({
            title: '标题',
            message: '代码是写出来给人看的,附带能在机器上运行',
            onCancel: () => console.log('cancel'),
            onConfirm: () => console.log('confirm')
})

如果希望外部组件控制,请参照组件调用