2020-11-14 03:16:28 +00:00
|
|
|
<script lang="ts">
|
2020-11-14 03:50:24 +00:00
|
|
|
import { defineComponent, h } from 'vue';
|
2021-03-23 08:30:14 +00:00
|
|
|
import MkRadio from '@client/components/ui/radio.vue';
|
2020-11-14 03:16:28 +00:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
|
|
|
MkRadio
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
modelValue: {
|
|
|
|
required: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
value: this.modelValue,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
value() {
|
|
|
|
this.$emit('update:modelValue', this.value);
|
|
|
|
}
|
2020-11-14 03:50:24 +00:00
|
|
|
},
|
|
|
|
render() {
|
|
|
|
const label = this.$slots.desc();
|
|
|
|
const options = this.$slots.default();
|
|
|
|
|
|
|
|
return h('div', {
|
|
|
|
class: 'novjtcto'
|
|
|
|
}, [
|
|
|
|
h('div', label),
|
|
|
|
...options.map(option => h(MkRadio, {
|
|
|
|
key: option.props.value,
|
|
|
|
value: option.props.value,
|
|
|
|
modelValue: this.value,
|
|
|
|
'onUpdate:modelValue': value => this.value = value,
|
|
|
|
}, option.children))
|
|
|
|
]);
|
2020-11-14 03:16:28 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2020-11-18 03:09:14 +00:00
|
|
|
<style lang="scss">
|
2020-11-14 03:16:28 +00:00
|
|
|
.novjtcto {
|
|
|
|
margin: 32px 0;
|
|
|
|
|
|
|
|
&:first-child {
|
|
|
|
margin-top: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
margin-bottom: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|