mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-23 18:00:27 +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() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: {
|
loading: {
|
||||||
|
@ -17,9 +17,12 @@ function initInstance() {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onToggle(show) {
|
toggle(show) {
|
||||||
this.dialogProps.show = show;
|
this.dialogProps.show = show;
|
||||||
},
|
},
|
||||||
|
setProps(props) {
|
||||||
|
this.dialogProps = props;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
@ -27,7 +30,7 @@ function initInstance() {
|
|||||||
lazyRender={false}
|
lazyRender={false}
|
||||||
{...{
|
{...{
|
||||||
...this.dialogProps,
|
...this.dialogProps,
|
||||||
'onUpdate:show': this.onToggle,
|
'onUpdate:show': this.toggle,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@ -46,22 +49,21 @@ function Dialog(options) {
|
|||||||
initInstance();
|
initInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.dialogProps = {
|
instance.setProps({
|
||||||
...Dialog.currentOptions,
|
...Dialog.currentOptions,
|
||||||
...options,
|
...options,
|
||||||
callback: (action) => {
|
callback: (action) => {
|
||||||
(action === 'confirm' ? resolve : reject)(action);
|
(action === 'confirm' ? resolve : reject)(action);
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
instance.dialogProps.show = true;
|
instance.toggle(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog.defaultOptions = {
|
Dialog.defaultOptions = {
|
||||||
show: false,
|
|
||||||
title: '',
|
title: '',
|
||||||
width: '',
|
width: '',
|
||||||
message: '',
|
message: '',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user