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

55 lines
870 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<docs>
---
order: 4
title:
zh-CN: 栅格列表
en-US: Grid
---
## zh-CN
可以通过设置 `List` `grid` 属性来实现栅格列表`column` 可设置期望显示的列数
## en-US
Creating a grid list by setting the `grid` property of List
</docs>
<template>
<a-list :grid="{ gutter: 16, column: 4 }" :data-source="data">
<template #renderItem="{ item }">
<a-list-item>
<a-card :title="item.title">Card content</a-card>
</a-list-item>
</template>
</a-list>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
interface DataItem {
title: string;
}
const data: DataItem[] = [
{
title: 'Title 1',
},
{
title: 'Title 2',
},
{
title: 'Title 3',
},
{
title: 'Title 4',
},
];
export default defineComponent({
setup() {
return {
data,
};
},
});
</script>