doc: uppate table
parent
61e8bfdb8c
commit
562d86f189
|
@ -17,19 +17,26 @@ Simple table with actions.
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-table :columns="columns" :data-source="data">
|
<a-table :columns="columns" :data-source="data">
|
||||||
<template #name="{ text }">
|
<template #headerCell="{ title, column }">
|
||||||
<a>{{ text }}</a>
|
<template v-if="column.key === 'name'">
|
||||||
</template>
|
|
||||||
<template #customTitle>
|
|
||||||
<span>
|
<span>
|
||||||
<smile-outlined />
|
<smile-outlined />
|
||||||
Name
|
Name
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #tags="{ text: tags }">
|
<template v-else>{{ title }}</template>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'name'">
|
||||||
|
<a>
|
||||||
|
{{ record.name }}
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="column.key === 'tags'">
|
||||||
<span>
|
<span>
|
||||||
<a-tag
|
<a-tag
|
||||||
v-for="tag in tags"
|
v-for="tag in record.tags"
|
||||||
:key="tag"
|
:key="tag"
|
||||||
:color="tag === 'loser' ? 'volcano' : tag.length > 5 ? 'geekblue' : 'green'"
|
:color="tag === 'loser' ? 'volcano' : tag.length > 5 ? 'geekblue' : 'green'"
|
||||||
>
|
>
|
||||||
|
@ -37,7 +44,7 @@ Simple table with actions.
|
||||||
</a-tag>
|
</a-tag>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #action="{ record }">
|
<template v-else-if="column.key === 'action'">
|
||||||
<span>
|
<span>
|
||||||
<a>Invite 一 {{ record.name }}</a>
|
<a>Invite 一 {{ record.name }}</a>
|
||||||
<a-divider type="vertical" />
|
<a-divider type="vertical" />
|
||||||
|
@ -49,6 +56,8 @@ Simple table with actions.
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else>{{ record.name }}</template>
|
||||||
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -56,9 +65,9 @@ import { SmileOutlined, DownOutlined } from '@ant-design/icons-vue';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
|
name: 'Name',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
key: 'name',
|
key: 'name',
|
||||||
slots: { title: 'customTitle', customRender: 'name' },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Age',
|
title: 'Age',
|
||||||
|
@ -74,12 +83,10 @@ const columns = [
|
||||||
title: 'Tags',
|
title: 'Tags',
|
||||||
key: 'tags',
|
key: 'tags',
|
||||||
dataIndex: 'tags',
|
dataIndex: 'tags',
|
||||||
slots: { customRender: 'tags' },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Action',
|
title: 'Action',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
slots: { customRender: 'action' },
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue