import { h } from 'vue'; import { Tag,Avatar } from 'ant-design-vue'; export const columns = [ { title: 'ID', dataIndex: 'id', fixed:'left', width: 100, }, { title: '广告标题', dataIndex: 'title', width: 250, customRender({ record }) { return h('a', { href: record.url, target:"_blank" }, record.title); }, }, { title: '广告封面', dataIndex: 'cover', customRender({ record }) { return h(Avatar, { size: 35, src: record.cover, shape: 'square', fit: 'fill', }); }, width: 100, }, { title: '广告类型', dataIndex: 'type', customRender({ record }) { let typeText = '' switch (record.type) { case 1: typeText='图片' break; case 2: typeText='文字' break; case 3: typeText='视频' break; default: break; } return h('span', typeText || '-'); }, width:100 }, { title: '广告状态', dataIndex: 'status', customRender({ record }) { return h( Tag, { color: record.status ==1 ? 'success' : 'error', }, { default: () => (record.status ==1 ? '正常' : '停用'), }, ); }, width:100 }, { title: '广告尺寸', dataIndex: 'size', customRender({ record }) { return record.width + 'x' + record.height; }, width:100 }, { title: '投放时间', dataIndex: 'time', customRender({ record }) { return record.startTime + '-' + record.endTime; }, width:300 }, { title: '点击量', dataIndex: 'click', width:100 }, { title: '排序', dataIndex: 'sort', width:100 }, { title: '创建人', dataIndex: 'createUser', width:100 }, { title: '创建时间', dataIndex: 'createTime', width: 180, }, { title: '操作', fixed:'right', dataIndex: 'action', key: 'action', width: 200, }, ];