wms-naivevue/src/views/content/article/columns.ts

91 lines
1.4 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: 200,
render(record) {
return h(
'a',
{
href: 'http://www.baidu.com',
target: '_blank',
},
record.title,
);
},
},
{
title: '文章封面',
key: 'cover',
width: 100,
render(record) {
return h(NImage, {
width: 48,
src: record.cover,
shape: 'square',
fit: 'fill',
});
},
},
{
title: '文章分类',
key: 'categoryName',
width: 100,
},
{
title: '文章作者',
key: 'author',
width: 100,
},
{
title: '文章状态',
key: 'status',
width: 100,
render(record) {
return h(
NTag,
{
type: record.status == 1 ? 'error' : 'success',
},
{
default: () => (record.status == 1 ? '下架' : '正常'),
},
);
},
},
{
title: '点击率',
key: 'click',
width: 100,
},
{
title: '文章排序',
key: 'sort',
width: 100,
},
{
title: '创建人',
key: 'createUser',
width: 100,
},
{
title: '创建时间',
key: 'createTime',
width: 180,
},
];