fix:修复dialog无法关闭的问题

This commit is contained in:
zlong committed 2024-11-21 21:38:27 +08:00
1 parent f8425de967
commit a859521682
3 files changed
+20 -27

No files matched your search

+11 -16
View File
@@ -2,11 +2,9 @@
import RegularPage from '@/components/RegularPage.vue'
import { onMounted, ref, reactive } from 'vue'
import type { BaseTableColumns } from 'tdesign-vue-next'
import type { Classify } from '@/model/classify'
import ClassifyDialog from '@/pages/carousal/components/CarousalDialog.vue'
import CarousalDialog from '@/pages/carousal/components/CarousalDialog.vue'
import { activeCarousal, deleteCarousal, getCarousalList, inactiveCarousal } from '@/api/carousal'
import { BrowseIcon } from 'tdesign-icons-vue-next'
import { aS } from 'vitest/dist/reporters-yx5ZTtEV'
const columns: BaseTableColumns = [
{
@@ -44,7 +42,7 @@ const query = reactive({
const carousalDialogVisible = ref(false)
const isEdit = ref(false)
const currentTableData = ref<{}>({})
const fetchClassifyTableData = async () => {
const fetchSaveCarousalData = async () => {
/* TODO: 获取轮播图表格数据 */
query.page = pagination.page
query.size = pagination.size
@@ -52,7 +50,7 @@ const fetchClassifyTableData = async () => {
data.value = getCarousalListApi.data
pagination.total = getCarousalListApi.pagination.total
}
onMounted(fetchClassifyTableData)
onMounted(fetchSaveCarousalData)
const editClick = (row:object) => {
isEdit.value = true
currentTableData.value = Object.assign({}, row)
@@ -64,12 +62,12 @@ const showClick = async (res:object) => {
} else {
await activeCarousal(res.id)
}
await fetchClassifyTableData()
await fetchSaveCarousalData()
}
const delClick = async (row:object) => {
console.log(row,'删除')
await deleteCarousal(row.id)
await fetchClassifyTableData()
await fetchSaveCarousalData()
}
const handleCreateCarousal = () => {
isEdit.value = false
@@ -79,12 +77,9 @@ const handleCreateCarousal = () => {
const onPageChange = () => {
/* TODO: 分页切换 */
}
const handleSuccessDialog = async (res) => {
console.log(res,'res')
if (res){
console.log(123)
await fetchClassifyTableData()
}
const handleSuccessDialog = async () => {
await fetchSaveCarousalData()
carousalDialogVisible.value = false
}
</script>
@@ -142,13 +137,13 @@ const handleSuccessDialog = async (res) => {
<TButton variant="text" size="small" theme="danger" @click="delClick(row)">删除</TButton>
</template>
</TTable>
<ClassifyDialog
:classify="currentTableData"
<CarousalDialog
:carousal="currentTableData"
v-model:visible="carousalDialogVisible"
:isEdit="isEdit"
@success="handleSuccessDialog"
headerTitle="轮播图"
></ClassifyDialog>
></CarousalDialog>
</RegularPage>
</template>