feat(composables): 添加弹窗关闭通知的通用逻辑
This commit is contained in:
parent
4f415fce9e
commit
45f7d0406f
14
mes-ui/mes-ui-admin-vue3/src/composables/useDialogClose.ts
Normal file
14
mes-ui/mes-ui-admin-vue3/src/composables/useDialogClose.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { watch } from 'vue'
|
||||
|
||||
/**
|
||||
* 弹窗关闭时通知父组件的通用逻辑
|
||||
* @param dialogVisible 弹窗可见性状态
|
||||
* @param emit 事件发射器
|
||||
*/
|
||||
export function useDialogClose(dialogVisible: any, emit: any) {
|
||||
watch(dialogVisible, (val) => {
|
||||
if (!val) {
|
||||
emit('close')
|
||||
}
|
||||
})
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user