This commit is contained in:
kailong321200875 2024-01-09 15:08:53 +08:00
parent ef9aa62572
commit 9b2b4d42a6
2 changed files with 89 additions and 80 deletions

View File

@ -69,7 +69,7 @@ const initColumns = (columns: TableColumn[], isReStore = false) => {
}
return (item.type && !DEFAULT_FILTER_COLUMN.includes(item.type)) || !item.type
})
if (!unref(oldColumns)) {
if (!unref(oldColumns)?.length) {
oldColumns.value = cloneDeep(newColumns)
}
settingColumns.value = cloneDeep(newColumns)
@ -96,7 +96,8 @@ watch(
initColumns(columns)
},
{
immediate: true
immediate: true,
deep: true
}
)
</script>

View File

@ -3,7 +3,7 @@ import { ContentWrap } from '@/components/ContentWrap'
import { useI18n } from '@/hooks/web/useI18n'
import { Table, TableColumn, TableSlotDefault } from '@/components/Table'
import { getTableListApi } from '@/api/table'
import { ref, reactive, unref } from 'vue'
import { ref, reactive, unref, onMounted } from 'vue'
import { ElTag } from 'element-plus'
import { useTable } from '@/hooks/web/useTable'
import { BaseButton } from '@/components/Button'
@ -26,7 +26,12 @@ const { setProps, setColumn, getElTableExpose, addColumn, delColumn, refresh } =
const { t } = useI18n()
const columns = reactive<TableColumn[]>([
const columns = reactive<TableColumn[]>([])
onMounted(() => {
setTimeout(() => {
setProps({
columns: [
{
field: 'expand',
type: 'expand',
@ -102,7 +107,10 @@ const columns = reactive<TableColumn[]>([
}
}
}
])
]
})
}, 2000)
})
const actionFn = (data: TableSlotDefault) => {
console.log(data)