mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-30 03:01:53 +08:00
feat: 优化post界面
This commit is contained in:
parent
a379e3a206
commit
563eb8ba90
@ -39,7 +39,7 @@ const emit = defineEmits(['success'])
|
|||||||
|
|
||||||
// 弹窗相关的变量
|
// 弹窗相关的变量
|
||||||
const modelVisible = ref(false) // 是否显示弹出层
|
const modelVisible = ref(false) // 是否显示弹出层
|
||||||
const modelTitle = ref('edit') // 弹出层标题
|
const modelTitle = ref('update') // 弹出层标题
|
||||||
const modelLoading = ref(false) // 弹出层loading
|
const modelLoading = ref(false) // 弹出层loading
|
||||||
const actionType = ref('') // 操作按钮的类型
|
const actionType = ref('') // 操作按钮的类型
|
||||||
const actionLoading = ref(false) // 按钮 Loading
|
const actionLoading = ref(false) // 按钮 Loading
|
||||||
@ -67,7 +67,7 @@ const openModal = async (type: string, rowId?: number) => {
|
|||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
const elForm = unref(formRef)?.getElFormRef()
|
const elForm = unref(formRef)?.getElFormRef()
|
||||||
if (!elForm) return
|
if (!elForm) return
|
||||||
elForm.validate(async (valid) => {
|
const valid = await elForm.validate()
|
||||||
if (valid) {
|
if (valid) {
|
||||||
actionLoading.value = true
|
actionLoading.value = true
|
||||||
// 提交请求
|
// 提交请求
|
||||||
@ -86,7 +86,6 @@ const submitForm = async () => {
|
|||||||
actionLoading.value = false
|
actionLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ openModal: openModal })
|
defineExpose({ openModal: openModal })
|
||||||
|
@ -51,7 +51,7 @@ import { allSchemas } from './post.data'
|
|||||||
import PostForm from './PostForm.vue'
|
import PostForm from './PostForm.vue'
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const modalRef = ref()
|
|
||||||
// 列表相关的变量
|
// 列表相关的变量
|
||||||
const [registerTable, { reload, deleteData, exportList }] = useXTable({
|
const [registerTable, { reload, deleteData, exportList }] = useXTable({
|
||||||
allSchemas: allSchemas,
|
allSchemas: allSchemas,
|
||||||
@ -59,7 +59,8 @@ const [registerTable, { reload, deleteData, exportList }] = useXTable({
|
|||||||
deleteApi: PostApi.deletePostApi,
|
deleteApi: PostApi.deletePostApi,
|
||||||
exportListApi: PostApi.exportPostApi
|
exportListApi: PostApi.exportPostApi
|
||||||
})
|
})
|
||||||
|
// 表单相关的变量
|
||||||
|
const modalRef = ref()
|
||||||
const openModal = (type: string, rowId?: number) => {
|
const openModal = (type: string, rowId?: number) => {
|
||||||
modalRef.value.openModal(type, rowId)
|
modalRef.value.openModal(type, rowId)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user