Skip to content

Commit e126088

Browse files
Update BaseTable.vue
1 parent deb71ce commit e126088

1 file changed

Lines changed: 12 additions & 16 deletions

File tree

packages/builtinComponent/src/components/BaseTable.vue

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44
<template v-else>
55
<tiny-grid ref="gridRef" :data="tableData" v-bind="gridState">
66
<tiny-grid-column v-if="gridState.selectedEnabled" type="selection" width="60"></tiny-grid-column>
7-
<template v-for="item in gridColumns" :key="item.prop">
8-
<tiny-grid-column :field="item.prop" :title="item.label" :editor="item.editor"></tiny-grid-column>
9-
</template>
7+
<tiny-grid-column
8+
v-for="item in gridColumns"
9+
:key="item.prop"
10+
:field="item.prop"
11+
:title="item.label"
12+
:editor="item.editor"
13+
></tiny-grid-column>
14+
1015
<tiny-grid-column v-if="gridState.rowOperationEnabled" field="operation" title="操作">
1116
<template #default="data">
1217
<tiny-button
@@ -15,7 +20,7 @@
1520
type="text"
1621
@click="operate?.handler(data.row, data.rowIndex, exposedData)"
1722
>
18-
<div v-if="operate?.itemVisible">
23+
<div v-if="operate.itemVisible">
1924
<tiny-popover
2025
v-if="gridState.useIconOperation && operate.icon"
2126
width="auto"
@@ -43,7 +48,7 @@
4348
</div>
4449
</template>
4550
<script setup>
46-
import { defineProps, defineEmits, defineExpose, computed, ref, reactive, watch, useAttrs } from 'vue'
51+
import { defineProps, defineExpose, computed, ref, reactive, useAttrs } from 'vue'
4752
import {
4853
Grid as TinyGrid,
4954
GridColumn as TinyGridColumn,
@@ -93,8 +98,6 @@ const props = defineProps({
9398
}
9499
})
95100
96-
const emit = defineEmits(['update:modelValue'])
97-
98101
const attrs = useAttrs()
99102
100103
const gridRef = ref()
@@ -147,7 +150,8 @@ const rowOperationList = computed(() => {
147150
return props.rowOperations?.value.map((operate) => {
148151
return {
149152
...operate,
150-
icon: operate.icon ? tinyVueIcon?.[operate.icon]() : ''
153+
icon: operate.icon ? tinyVueIcon?.[operate.icon]() : '',
154+
itemVisible: 'itemVisible' in operate ? operate.itemVisible : true
151155
}
152156
})
153157
})
@@ -237,14 +241,6 @@ const deleteApi = (evidence) => {
237241
})
238242
}
239243
240-
watch(
241-
() => tableData.value,
242-
(value) => {
243-
emit('update:modelValue', value)
244-
},
245-
{ deep: true }
246-
)
247-
248244
const exposedData = {
249245
tableData: () => tableData.value,
250246
gridRef,

0 commit comments

Comments
 (0)