ant-design-vue/components/cascader/demo/multiple.vue

73 lines
1.2 KiB
Vue

<docs>
---
order: 5.1
version: 3.0.0
title:
zh-CN: 多选
en-US: Multiple
---
## zh-CN
一次性选择多个选项
## en-US
Select multiple options
</docs>
<template>
<a-cascader
v-model:value="value"
style="width: 100%"
multiple
max-tag-count="responsive"
:options="options"
placeholder="Please select"
></a-cascader>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
import type { CascaderProps } from 'ant-design-vue';
const options: CascaderProps['options'] = [
{
label: 'Light',
value: 'light',
children: new Array(20)
.fill(null)
.map((_, index) => ({ label: `Number ${index}`, value: index })),
},
{
label: 'Bamboo',
value: 'bamboo',
children: [
{
label: 'Little',
value: 'little',
children: [
{
label: 'Toy Fish',
value: 'fish',
},
{
label: 'Toy Cards',
value: 'cards',
},
{
label: 'Toy Bird',
value: 'bird',
},
],
},
],
},
];
export default defineComponent({
setup() {
return {
value: ref<string[]>([]),
options,
};
},
});
</script>