ant-design-vue/components/list/demo/simple.vue

79 lines
2.1 KiB
Vue
Raw Normal View History

2021-09-01 07:04:46 +00:00
<docs>
---
order: 1
title:
zh-CN: 简单列表
en-US: Simple list
---
## zh-CN
列表拥有大小三种尺寸
通过设置 `size` `large` `small` 分别把按钮设为大小尺寸若不设置 `size`则尺寸为中
可通过设置 `header` `footer`来自定义列表头部和尾部
## en-US
Ant Design supports a default list size as well as a large and small size.
If a large or small list is desired, set the size property to either large or small respectively. Omit the size property for a list with the default size.
Customizing the header and footer of list by setting `header` and `footer` property.
</docs>
<template>
<h3 :style="{ margin: '16px 0' }">Small Size</h3>
<a-list size="small" bordered :data-source="data">
<template #renderItem="{ item }">
<a-list-item>{{ item }}</a-list-item>
</template>
<template #header>
<div>Header</div>
</template>
<template #footer>
<div>Footer</div>
</template>
</a-list>
<h3 :style="{ marginBottom: '16px' }">Default Size</h3>
<a-list bordered :data-source="data">
<template #renderItem="{ item }">
<a-list-item>{{ item }}</a-list-item>
</template>
<template #header>
<div>Header</div>
</template>
<template #footer>
<div>Footer</div>
</template>
</a-list>
<h3 :style="{ margin: '16px 0' }">Large Size</h3>
<a-list size="large" bordered :data-source="data">
<template #renderItem="{ item }">
<a-list-item>{{ item }}</a-list-item>
</template>
<template #header>
<div>Header</div>
</template>
<template #footer>
<div>Footer</div>
</template>
</a-list>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
const data: string[] = [
'Racing car sprays burning fuel into crowd.',
'Japanese princess to wed commoner.',
'Australian walks 100km after outback crash.',
'Man charged over missing wedding girl.',
'Los Angeles battles huge wildfires.',
];
export default defineComponent({
setup() {
return {
data,
};
},
});
</script>