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.
42 lines
754 B
42 lines
754 B
1 year ago
|
<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>
|