update fileTable插槽处理
This commit is contained in:
@@ -24,18 +24,11 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<!-- baseTable插槽 单独处理leftOptions-->
|
<!-- baseTable插槽 单独处理leftOptions-->
|
||||||
<template v-for="(_, name) in $slots" #[name]="slotData">
|
<template v-for="(_, name) in filteredSlots" #[name]="slotData" :key="name">
|
||||||
<slot :name="name" v-bind="slotData"></slot>
|
<slot :name="name" v-bind="slotData"></slot>
|
||||||
</template>
|
</template>
|
||||||
|
<!-- 单独处理 leftOptions 插槽 -->
|
||||||
<!-- <template
|
<template #leftOptions>
|
||||||
v-for="(_, name) in $slots?.filter?.((v: any) => v.name !== 'leftOptions') ?? []"
|
|
||||||
#[name]="slotData"
|
|
||||||
:key="name"
|
|
||||||
>
|
|
||||||
<slot :name="name" v-bind="slotData"></slot>
|
|
||||||
</template> -->
|
|
||||||
<!-- <template #leftOptions>
|
|
||||||
<div class="left-options-wrapper">
|
<div class="left-options-wrapper">
|
||||||
<slot name="leftOptions"></slot>
|
<slot name="leftOptions"></slot>
|
||||||
<el-button
|
<el-button
|
||||||
@@ -45,7 +38,7 @@
|
|||||||
>刷新</el-button
|
>刷新</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</template> -->
|
</template>
|
||||||
</BaseTable>
|
</BaseTable>
|
||||||
<FilePreview v-model="previewVisible" :fileId="previewFileId" />
|
<FilePreview v-model="previewVisible" :fileId="previewFileId" />
|
||||||
<!-- 重命名 -->
|
<!-- 重命名 -->
|
||||||
@@ -80,7 +73,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, computed, onMounted, onBeforeUnmount } from 'vue';
|
import { ref, computed, onMounted, onBeforeUnmount, useSlots } from 'vue';
|
||||||
import BaseTable from '@/components/common/table/baseTable.vue';
|
import BaseTable from '@/components/common/table/baseTable.vue';
|
||||||
import FilePreview from '@/components/common/filePreview/index.vue';
|
import FilePreview from '@/components/common/filePreview/index.vue';
|
||||||
import { downloadFileById } from '@/utils/file';
|
import { downloadFileById } from '@/utils/file';
|
||||||
@@ -127,6 +120,19 @@ const fileTableRef = ref();
|
|||||||
const previewVisible = ref(false);
|
const previewVisible = ref(false);
|
||||||
const previewFileId = ref('');
|
const previewFileId = ref('');
|
||||||
|
|
||||||
|
const slots = useSlots();
|
||||||
|
|
||||||
|
// 计算过滤后的插槽(排除 leftOptions)
|
||||||
|
const filteredSlots = computed(() => {
|
||||||
|
const result: Record<string, any> = {};
|
||||||
|
Object.keys(slots).forEach((name) => {
|
||||||
|
if (name !== 'leftOptions') {
|
||||||
|
result[name] = slots[name];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
// #region ---------------------------操作栏---------------------------
|
// #region ---------------------------操作栏---------------------------
|
||||||
// 默认的操作栏, 如果有业务判断,就在业务组件内部写
|
// 默认的操作栏, 如果有业务判断,就在业务组件内部写
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|||||||
Reference in New Issue
Block a user