RadioButtonGroup
Demos
Size variants
Available values for the ui
prop: alt
/large
/small
/tiny
/micro
/square
.
Normal size
Selected: -
Small size & Square shape
<template>
<article>
<section>
<h4>Normal size</h4>
<veui-radio-button-group
v-model="flavor"
:items="flavors"
/>
<p>Selected: {{ readable }}</p>
</section>
<section>
<h4>Small size &amp; Square shape</h4>
<veui-radio-button-group
ui="small square"
:items="actions"
>
<veui-icon
slot-scope="{ value, label }"
:name="value"
:label="label"
/>
</veui-radio-button-group>
</section>
</article>
</template>
<script>
import { RadioButtonGroup, Icon } from 'veui'
import 'veui-theme-one/icons/pause'
import 'veui-theme-one/icons/play'
export default {
components: {
'veui-radio-button-group': RadioButtonGroup,
'veui-icon': Icon
},
data () {
return {
flavor: null,
flavors: [
{ value: 'LATTE', label: 'Latte' },
{ value: 'MOCHA', label: 'Mocha' },
{ value: 'AMERICANO', label: 'Americano' }
],
actions: [
{
label: '暂停',
value: 'pause'
},
{
label: '播放',
value: 'play'
}
]
}
},
computed: {
flavorLabelMap () {
return this.flavors.reduce((map, { value, label }) => {
map[value] = label
return map
}, {})
},
readable () {
return this.flavorLabelMap[this.flavor] || '-'
}
}
}
</script>
API
Props
Name | Type | Default | Description | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ui | string | - | Style variants.
| ||||||||||||||
items | Array<Object> | [] | The datasource of items with the item type being
| ||||||||||||||
value | * | - |
The | ||||||||||||||
disabled | boolean | false | Whether the radio button group is disabled. | ||||||||||||||
readonly | boolean | false | Whether the radio button group is read-only. |
Slots
Name | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
default | The label content of each button. Displays the value of the
Additionally, custom properties apart from the listed ones will also be passes into the scope object via |
Events
Name | Description |
---|---|
change |
Triggers when the selected item changed. The callback parameter list is |