原生示例列表,插槽slots换成最新语法

pull/663/head
zhangdaiscott 2023-07-19 15:52:52 +08:00
parent 77e3f47b3a
commit de804c0677
1 changed files with 34 additions and 36 deletions

View File

@ -43,39 +43,40 @@
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
@change="handleTableChange" @change="handleTableChange"
> >
<template slot="htmlSlot" slot-scope="text"> <template #bodyCell="{ column, text, record }">
<div v-html="text"></div> <template v-if="column.dataIndex==='tupian'">
</template> <span v-if="!text" style="font-size: 12px; font-style: italic"></span>
<template #imgSlot="{ text, record }"> <img v-else :src="getImgView(text)" :preview="record.id" alt="" class="anty-img-wrap" />
<span v-if="!text" style="font-size: 12px; font-style: italic"></span> </template>
<img v-else :src="getImgView(text)" :preview="record.id" alt="" class="anty-img-wrap" /> <template v-else-if="column.dataIndex==='wenjian'">
</template> <span v-if="!text" style="font-size: 12px; font-style: italic"></span>
<template #pcaSlot="{ text }"> <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download" size="small" @click="downloadFile(text)"> </a-button>
<div>{{ getAreaTextByCode(text) }}</div> </template>
</template> <template v-else-if="column.dataIndex==='action'">
<template #fileSlot="{ text }"> <a @click="handleEdit(record)"></a>
<span v-if="!text" style="font-size: 12px; font-style: italic"></span> <a-divider type="vertical" />
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download" size="small" @click="downloadFile(text)"> </a-button> <a-dropdown>
</template> <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<template #overlay>
<template #action="{ text, record }"> <a-menu class="antd-more">
<a @click="handleEdit(record)"></a> <a-menu-item>
<a-divider type="vertical" /> <a @click="handleDetail(record)"></a>
<a-dropdown> </a-menu-item>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a> <a-menu-item>
<template #overlay> <Popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a-menu class="antd-more"> <a>删除</a>
<a-menu-item> </Popconfirm>
<a @click="handleDetail(record)"></a> </a-menu-item>
</a-menu-item> </a-menu>
<a-menu-item> </template>
<Popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> </a-dropdown>
<a>删除</a> </template>
</Popconfirm> <!-- <template v-else-if="column.dataIndex==='htmlSlot'">
</a-menu-item> <div v-html="text"></div>
</a-menu> </template>
</template> <template v-else-if="column.dataIndex==='pcaSlot'">
</a-dropdown> <div>{{ getAreaTextByCode(text) }}</div>
</template> -->
</template> </template>
</a-table> </a-table>
</div> </div>
@ -160,13 +161,11 @@
title: '文件', title: '文件',
align: 'center', align: 'center',
dataIndex: 'wenjian', dataIndex: 'wenjian',
slots: { customRender: 'fileSlot' },
}, },
{ {
title: '图片', title: '图片',
align: 'center', align: 'center',
dataIndex: 'tupian', dataIndex: 'tupian',
slots: { customRender: 'imgSlot' },
}, },
{ {
title: '操作', title: '操作',
@ -174,7 +173,6 @@
align: 'center', align: 'center',
fixed: 'right', fixed: 'right',
width: 147, width: 147,
slots: { customRender: 'action' },
}, },
]); ]);