51 lines
1.2 KiB
Vue
51 lines
1.2 KiB
Vue
|
<template>
|
||
|
<div>
|
||
|
<RadioGroup :options="plainOptions" @change="onChange1" :defaultValue="value1" />
|
||
|
<br />
|
||
|
<RadioGroup :options="options" @change="onChange2" v-model="value2" />
|
||
|
<br />
|
||
|
<RadioGroup :options="optionsWithDisabled" disabled @change="onChange3" v-model="value3" />
|
||
|
</div>
|
||
|
</template>
|
||
|
<script>
|
||
|
import { Radio } 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,
|
||
|
value1: 'Apple',
|
||
|
value2: 'Apple',
|
||
|
value3: 'Apple',
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
onChange1 (e) {
|
||
|
console.log('radio1 checked', e.target.value)
|
||
|
},
|
||
|
onChange2 (e) {
|
||
|
console.log('radio2 checked', e.target.value)
|
||
|
},
|
||
|
onChange3 (e) {
|
||
|
console.log('radio3 checked', e.target.value)
|
||
|
},
|
||
|
},
|
||
|
components: {
|
||
|
Radio,
|
||
|
RadioGroup: Radio.Group,
|
||
|
},
|
||
|
}
|
||
|
</script>
|