mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(Dialog): missing emits config
This commit is contained in:
parent
040418dcd9
commit
49206598fc
@ -47,6 +47,8 @@ export default createComponent({
|
||||
},
|
||||
},
|
||||
|
||||
emits: ['opened', 'closed', 'confirm', 'cancel', 'update:show'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
loading: {
|
||||
|
@ -17,9 +17,12 @@ function initInstance() {
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
onToggle(show) {
|
||||
toggle(show) {
|
||||
this.dialogProps.show = show;
|
||||
},
|
||||
setProps(props) {
|
||||
this.dialogProps = props;
|
||||
},
|
||||
},
|
||||
render() {
|
||||
return (
|
||||
@ -27,7 +30,7 @@ function initInstance() {
|
||||
lazyRender={false}
|
||||
{...{
|
||||
...this.dialogProps,
|
||||
'onUpdate:show': this.onToggle,
|
||||
'onUpdate:show': this.toggle,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
@ -46,22 +49,21 @@ function Dialog(options) {
|
||||
initInstance();
|
||||
}
|
||||
|
||||
instance.dialogProps = {
|
||||
instance.setProps({
|
||||
...Dialog.currentOptions,
|
||||
...options,
|
||||
callback: (action) => {
|
||||
(action === 'confirm' ? resolve : reject)(action);
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
nextTick(() => {
|
||||
instance.dialogProps.show = true;
|
||||
instance.toggle(true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Dialog.defaultOptions = {
|
||||
show: false,
|
||||
title: '',
|
||||
width: '',
|
||||
message: '',
|
||||
|
Loading…
x
Reference in New Issue
Block a user