|
4 | 4 | <template v-else> |
5 | 5 | <tiny-grid ref="gridRef" :data="tableData" v-bind="gridState"> |
6 | 6 | <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 | + |
10 | 15 | <tiny-grid-column v-if="gridState.rowOperationEnabled" field="operation" title="操作"> |
11 | 16 | <template #default="data"> |
12 | 17 | <tiny-button |
|
15 | 20 | type="text" |
16 | 21 | @click="operate?.handler(data.row, data.rowIndex, exposedData)" |
17 | 22 | > |
18 | | - <div v-if="operate?.itemVisible"> |
| 23 | + <div v-if="operate.itemVisible"> |
19 | 24 | <tiny-popover |
20 | 25 | v-if="gridState.useIconOperation && operate.icon" |
21 | 26 | width="auto" |
|
43 | 48 | </div> |
44 | 49 | </template> |
45 | 50 | <script setup> |
46 | | -import { defineProps, defineEmits, defineExpose, computed, ref, reactive, watch, useAttrs } from 'vue' |
| 51 | +import { defineProps, defineExpose, computed, ref, reactive, useAttrs } from 'vue' |
47 | 52 | import { |
48 | 53 | Grid as TinyGrid, |
49 | 54 | GridColumn as TinyGridColumn, |
@@ -93,8 +98,6 @@ const props = defineProps({ |
93 | 98 | } |
94 | 99 | }) |
95 | 100 |
|
96 | | -const emit = defineEmits(['update:modelValue']) |
97 | | -
|
98 | 101 | const attrs = useAttrs() |
99 | 102 |
|
100 | 103 | const gridRef = ref() |
@@ -147,7 +150,8 @@ const rowOperationList = computed(() => { |
147 | 150 | return props.rowOperations?.value.map((operate) => { |
148 | 151 | return { |
149 | 152 | ...operate, |
150 | | - icon: operate.icon ? tinyVueIcon?.[operate.icon]() : '' |
| 153 | + icon: operate.icon ? tinyVueIcon?.[operate.icon]() : '', |
| 154 | + itemVisible: 'itemVisible' in operate ? operate.itemVisible : true |
151 | 155 | } |
152 | 156 | }) |
153 | 157 | }) |
@@ -237,14 +241,6 @@ const deleteApi = (evidence) => { |
237 | 241 | }) |
238 | 242 | } |
239 | 243 |
|
240 | | -watch( |
241 | | - () => tableData.value, |
242 | | - (value) => { |
243 | | - emit('update:modelValue', value) |
244 | | - }, |
245 | | - { deep: true } |
246 | | -) |
247 | | -
|
248 | 244 | const exposedData = { |
249 | 245 | tableData: () => tableData.value, |
250 | 246 | gridRef, |
|
0 commit comments