avatar-table-column.vue
680 Bytes
<script setup lang="ts">
import { Avatar } from '@arco-design/web-vue';
import TableColumn from '@/components/filter/table-column.vue';
import { get } from 'lodash';
const props = defineProps<{ title?: string; dataIndex?: string; width?: number }>();
const getValue = (record: object) => {
return get(record, props.dataIndex || '', '');
};
</script>
<template>
<TableColumn v-bind="$attrs" :title="title" :data-index="dataIndex" :width="width || 60" :tooltip="false">
<template #default="{ record }">
<Avatar :size="40" shape="circle" :image-url="getValue(record)" />
</template>
</TableColumn>
</template>
<style scoped lang="less"></style>