mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(ActionSheet): some events missed
This commit is contained in:
parent
296315c48f
commit
4d8d02151d
@ -44,7 +44,16 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
emits: ['close', 'cancel', 'select', 'update:show'],
|
emits: [
|
||||||
|
'open',
|
||||||
|
'close',
|
||||||
|
'opened',
|
||||||
|
'closed',
|
||||||
|
'cancel',
|
||||||
|
'select',
|
||||||
|
'update:show',
|
||||||
|
'click-overlay',
|
||||||
|
],
|
||||||
|
|
||||||
setup(props, { slots, emit }) {
|
setup(props, { slots, emit }) {
|
||||||
function onCancel() {
|
function onCancel() {
|
||||||
@ -52,9 +61,17 @@ export default createComponent({
|
|||||||
emit('cancel');
|
emit('cancel');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onToggle(show) {
|
const createEmitter = (name) => () => emit(name);
|
||||||
|
const listeners = {
|
||||||
|
onOpen: createEmitter('open'),
|
||||||
|
onClose: createEmitter('close'),
|
||||||
|
onOpened: createEmitter('opened'),
|
||||||
|
onClosed: createEmitter('closed'),
|
||||||
|
'onClick-overlay': createEmitter('click-overlay'),
|
||||||
|
'onUpdate:show': (show) => {
|
||||||
emit('update:show', show);
|
emit('update:show', show);
|
||||||
}
|
},
|
||||||
|
};
|
||||||
|
|
||||||
return function () {
|
return function () {
|
||||||
const { title, cancelText } = props;
|
const { title, cancelText } = props;
|
||||||
@ -153,7 +170,7 @@ export default createComponent({
|
|||||||
closeOnPopstate={props.closeOnPopstate}
|
closeOnPopstate={props.closeOnPopstate}
|
||||||
closeOnClickOverlay={props.closeOnClickOverlay}
|
closeOnClickOverlay={props.closeOnClickOverlay}
|
||||||
safeAreaInsetBottom={props.safeAreaInsetBottom}
|
safeAreaInsetBottom={props.safeAreaInsetBottom}
|
||||||
{...{ 'onUpdate:show': onToggle }}
|
{...listeners}
|
||||||
>
|
>
|
||||||
{Header()}
|
{Header()}
|
||||||
{Description}
|
{Description}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user