22 lines
476 B
TypeScript
Raw Normal View History

2022-12-07 19:28:57 +08:00
import { ref } from 'vue'
import { t } from '/admin/support/helper'
export function useOpen() {
2022-12-10 18:29:42 +08:00
const visible = ref<boolean>(false)
const id = ref(null)
const title = ref<string>('')
2022-12-11 22:26:21 +08:00
const open = (primary: any = null) => {
2022-12-07 19:28:57 +08:00
title.value = primary ? t('system.edit') : t('system.add')
id.value = primary
visible.value = true
}
const close = (func: Function) => {
visible.value = false
func()
}
return { open, close, title, visible, id }
}