diff --git a/docs/component/select-picker.md b/docs/component/select-picker.md index ed45617d..2fa796aa 100644 --- a/docs/component/select-picker.md +++ b/docs/component/select-picker.md @@ -377,6 +377,8 @@ function handleConfirm({ value, selectedItems }) { | confirm | 点击确认时触发 | event.detail = { value, selectedItems }, checkbox 类型时 value 和 selectedItems 为数组,radio 类型为非数组 | - | | change | picker 内选项更改时触发 | `{ value }`, checkbox 类型时 value 为数组,radio 类型为非数组 | - | | cancel | 点击关闭按钮或者蒙层时触发 | - | - | +| close | 弹窗关闭时触发 | - | 1.2.29 | +| open | 弹窗打开时触发 | - | 1.2.29 | ## Methods diff --git a/src/uni_modules/wot-design-uni/components/wd-select-picker/wd-select-picker.vue b/src/uni_modules/wot-design-uni/components/wd-select-picker/wd-select-picker.vue index 6daaea4d..027c6d51 100644 --- a/src/uni_modules/wot-design-uni/components/wd-select-picker/wd-select-picker.vue +++ b/src/uni_modules/wot-design-uni/components/wd-select-picker/wd-select-picker.vue @@ -126,7 +126,7 @@ import { selectPickerProps, type SelectPickerExpose } from './types' const { translate } = useTranslate('select-picker') const props = defineProps(selectPickerProps) -const emit = defineEmits(['change', 'cancel', 'confirm', 'update:modelValue']) +const emit = defineEmits(['change', 'cancel', 'confirm', 'update:modelValue','open','close']) const pickerShow = ref(false) const selectList = ref | number | boolean | string>([]) @@ -330,6 +330,7 @@ function close() { selectList.value = valueFormat(lastSelectList.value) } emit('cancel') + emit('close') } function open() { @@ -337,12 +338,14 @@ function open() { selectList.value = valueFormat(props.modelValue) pickerShow.value = true isConfirm.value = false + emit('open') } function onConfirm() { if (props.loading) { pickerShow.value = false emit('confirm') + emit('close') return } if (props.beforeConfirm) { @@ -371,6 +374,7 @@ function handleConfirm() { value: lastSelectList.value, selectedItems }) + emit('close') } function getFilterText(label: string, filterVal: string) {