<template>
<a-table
:columns="columns"
>
<template #names="{ column, record ,index,text}">
//column 为{ title: 'name',
dataIndex: 'name',
key: 'name',}
</template>
</a-table>
</template>
<script>
import {
defineComponent,
nextTick,
watch,
computed,
ref,
} from "vue";
export default defineComponent({
props: {
},
setup(props, { emit }) {
const columns=ref(
[
{
title: 'name',
dataIndex: 'name',
key: 'name',
slots: {
customRender: 'names',
},
},
{
title: 'Age',
dataIndex: 'age',
key: 'age',
},
{
title: 'Address',
dataIndex: 'address',
key: 'address',
},
])
return {
columns,
};
},
});
</script>
ant-vue组建a-table里的customRender里获取当前的key值
最新推荐文章于 2025-02-08 18:38:43 发布
这篇博客介绍了在Vue.js应用中如何使用`<a-table>`组件,并通过`slots`属性自定义列的渲染方式。文章展示了如何定义`columns`数组,包括设置`customRender`属性来指定模板内的插槽,以及在`<template>`中处理`names`插槽,展示`name`字段的数据。
部署运行你感兴趣的模型镜像
您可能感兴趣的与本文相关的镜像
Stable-Diffusion-3.5
图片生成
Stable-Diffusion
Stable Diffusion 3.5 (SD 3.5) 是由 Stability AI 推出的新一代文本到图像生成模型,相比 3.0 版本,它提升了图像质量、运行速度和硬件效率
9460

被折叠的 条评论
为什么被折叠?



