perf: post

This commit is contained in:
xingyu 2023-02-02 10:55:24 +08:00
parent 6f1ff72927
commit 9ebff2787e
2 changed files with 5 additions and 9 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<!-- 弹窗 --> <!-- 弹窗 -->
<XModal id="postModel" :loading="modelLoading" v-model="modelVisible" :title="modelTitle"> <XModal id="PostForm" :loading="modelLoading" v-model="modelVisible" :title="modelTitle">
<!-- 表单添加/修改 --> <!-- 表单添加/修改 -->
<Form <Form
ref="formRef" ref="formRef"
@ -35,7 +35,7 @@ import { rules, allSchemas } from './post.data'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
const emit = defineEmits(['success', 'openModal']) const emit = defineEmits(['success'])
// //
const modelVisible = ref(false) // const modelVisible = ref(false) //
@ -81,9 +81,9 @@ const submitForm = async () => {
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
modelVisible.value = false modelVisible.value = false
emit('success')
} finally { } finally {
actionLoading.value = false actionLoading.value = false
emit('success')
} }
} }
}) })

View File

@ -42,13 +42,13 @@
</template> </template>
</XTable> </XTable>
</ContentWrap> </ContentWrap>
<PostModal ref="modalRef" @success="success" /> <PostForm ref="modalRef" @success="reload()" />
</template> </template>
<script setup lang="ts" name="Post"> <script setup lang="ts" name="Post">
// import // import
import * as PostApi from '@/api/system/post' import * as PostApi from '@/api/system/post'
import { allSchemas } from './post.data' import { allSchemas } from './post.data'
import PostModal from './PostModal.vue' import PostForm from './PostForm.vue'
const { t } = useI18n() // const { t } = useI18n() //
const modalRef = ref() const modalRef = ref()
@ -63,8 +63,4 @@ const [registerTable, { reload, deleteData, exportList }] = useXTable({
const openModal = (type: string, rowId?: number) => { const openModal = (type: string, rowId?: number) => {
modalRef.value.openModal(type, rowId) modalRef.value.openModal(type, rowId)
} }
const success = () => {
reload()
}
</script> </script>