41 lines
754 B
41 lines
754 B
<template>
|
|
<ElRadioGroup class='RadioGroup' v-bind="$attrs" v-on="$listeners">
|
|
<component :is="type === 'button' ? 'RadioButton' : 'Radio'" v-for="item in list" :key="item.key" :label="item.key">
|
|
{{ item.label }}
|
|
</component>
|
|
</ElRadioGroup>
|
|
</template>
|
|
|
|
<script>
|
|
import Radio from "./Radio.vue"
|
|
import RadioButton from "./RadioButton.vue"
|
|
|
|
export default {
|
|
name: 'RadioGroup',
|
|
components: {
|
|
Radio,
|
|
RadioButton
|
|
},
|
|
props: {
|
|
type: {
|
|
type: String,
|
|
// button | normal
|
|
default: "normal"
|
|
},
|
|
/**
|
|
* {
|
|
* label: string;
|
|
* key: string;
|
|
* }[]
|
|
*/
|
|
list: {
|
|
type: Array,
|
|
default: () => []
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang='scss' scoped>
|
|
.RadioGroup {}
|
|
</style>
|
|
|