You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/checkbox/demo/group.vue

45 lines
1.1 KiB

7 years ago
<template>
<div>
7 years ago
<a-checkbox-group :options="plainOptions" v-model="value" @change="onChange" />
7 years ago
<br />
7 years ago
<a-checkbox-group :options="plainOptions" :defaultValue="['Apple']" @change="onChange" />
7 years ago
<br />
7 years ago
<a-checkbox-group :options="options" :value="['Pear']" @change="onChange" />
7 years ago
<br />
7 years ago
<a-checkbox-group :options="optionsWithDisabled" disabled :defaultValue="['Apple']" @change="onChange" />
7 years ago
</div>
</template>
<script>
import { Checkbox } from 'antd'
const plainOptions = ['Apple', 'Pear', 'Orange']
const options = [
{ label: 'Apple', value: 'Apple' },
{ label: 'Pear', value: 'Pear' },
{ label: 'Orange', value: 'Orange' },
]
const optionsWithDisabled = [
{ label: 'Apple', value: 'Apple' },
{ label: 'Pear', value: 'Pear' },
{ label: 'Orange', value: 'Orange', disabled: false },
]
export default {
data () {
return {
plainOptions,
options,
optionsWithDisabled,
value: [],
}
},
methods: {
onChange (checkedValues) {
console.log('checked = ', checkedValues)
console.log('value = ', this.value)
},
},
components: {
Checkbox,
},
}
</script>