|
|
@@ -30,7 +30,9 @@ import { ModalProps } from 'ant-design-vue'
|
|
|
import { ref, watch, watchEffect, computed, CSSProperties, reactive, onMounted } from 'vue'
|
|
|
|
|
|
export interface ModalProPorps extends ModalProps {
|
|
|
- label: string
|
|
|
+ label: string,
|
|
|
+ okRequest: () =>void,
|
|
|
+ openConfirmLoading: boolean
|
|
|
}
|
|
|
|
|
|
export interface ModalOkProps {
|
|
|
@@ -40,7 +42,7 @@ export interface ModalOkProps {
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
(e: 'close'): void
|
|
|
- (e: 'ok', arg: ModalOkProps): void
|
|
|
+ (e: 'ok'): void
|
|
|
}>()
|
|
|
|
|
|
const props = defineProps<ModalProPorps>()
|
|
|
@@ -53,11 +55,13 @@ const state = reactive<Partial<StateProps>>({})
|
|
|
|
|
|
const close = () => emit('close')
|
|
|
|
|
|
-const handleOk = () => {
|
|
|
- emit('ok', {
|
|
|
- confirmStart: () => state.confirmLoading = true,
|
|
|
- confirmed: () => state.confirmLoading = false
|
|
|
- })
|
|
|
+const handleOk = async () => {
|
|
|
+ if (props.okRequest) {
|
|
|
+ state.confirmLoading = true
|
|
|
+ await props.okRequest()
|
|
|
+ state.confirmLoading = false
|
|
|
+ }
|
|
|
+ emit('ok')
|
|
|
}
|
|
|
|
|
|
// 拖拽相关的代码
|