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

84 lines
1.4 KiB
TypeScript

import { h } from 'vue';
import { NTag } from 'naive-ui';
export const columns = [
{
type: 'selection',
width: 50,
fixed: 'left',
},
{
title: 'ID',
key: 'id',
fixed: 'left',
width: 50,
},
{
title: '友链名称',
key: 'name',
width: 100,
},
{
title: '友链类型',
key: 'type',
width: 100,
render(record) {
return h('span', record.type === 1 ? '友情链接' : '合作伙伴');
},
},
{
title: '友链形式',
key: 'form',
width: 100,
render(record) {
return h('span', record.form === 1 ? '文字链接' : '图片链接');
},
},
{
title: '友链地址',
key: 'url',
width: 200,
render(record) {
return h(
'a',
{
href: record.url,
target: '_blank',
},
record.url,
);
},
},
{
title: '状态',
key: 'status',
width: 100,
render(record) {
return h(
NTag,
{
type: record.status == 1 ? 'success' : 'error',
},
{
default: () => (record.status == 1 ? '正常' : '停用'),
},
);
},
},
{
title: '排序',
key: 'sort',
width: 100,
},
{
title: '创建人',
key: 'createUser',
width: 100,
},
{
title: '创建时间',
key: 'createTime',
width: 180,
},
];