82 lines
1.3 KiB
TypeScript
82 lines
1.3 KiB
TypeScript
import { h } from 'vue';
|
|
import { NImage, NTag } from 'naive-ui';
|
|
|
|
export const columns = [
|
|
{
|
|
type: 'selection',
|
|
width: 50,
|
|
fixed: 'left',
|
|
},
|
|
{
|
|
title: 'ID',
|
|
key: 'id',
|
|
fixed: 'left',
|
|
width: 50,
|
|
},
|
|
{
|
|
title: '通知标题',
|
|
key: 'title',
|
|
width: 250,
|
|
},
|
|
{
|
|
title: '通知封面',
|
|
key: 'cover',
|
|
width: 100,
|
|
render(record) {
|
|
return h(NImage, {
|
|
width: 48,
|
|
src: record.cover,
|
|
shape: 'square',
|
|
fit: 'fill',
|
|
});
|
|
},
|
|
},
|
|
{
|
|
title: '通知类型',
|
|
key: 'type',
|
|
width: 100,
|
|
render(record) {
|
|
return h(
|
|
NTag,
|
|
{
|
|
type: record.type == 1 ? 'info' : 'success',
|
|
},
|
|
{
|
|
default: () => (record.type == 1 ? '通知' : '公告'),
|
|
},
|
|
);
|
|
},
|
|
},
|
|
{
|
|
title: '通知状态',
|
|
key: 'status',
|
|
width: 100,
|
|
render(record) {
|
|
return h(
|
|
NTag,
|
|
{
|
|
type: record.status == 1 ? 'success' : 'error',
|
|
},
|
|
{
|
|
default: () => (record.status == 1 ? '正常' : '禁用'),
|
|
},
|
|
);
|
|
},
|
|
},
|
|
{
|
|
title: '点击率',
|
|
key: 'clickNum',
|
|
width: 100,
|
|
},
|
|
{
|
|
title: '创建人',
|
|
key: 'createUser',
|
|
width: 100,
|
|
},
|
|
{
|
|
title: '创建时间',
|
|
key: 'createTime',
|
|
width: 180,
|
|
},
|
|
];
|