mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-24 21:19:07 +01:00
56 lines
896 B
Vue
56 lines
896 B
Vue
<script lang="ts">
|
|
import { defineComponent, h } from 'vue';
|
|
import MkRadio from '@client/components/ui/radio.vue';
|
|
|
|
export default defineComponent({
|
|
components: {
|
|
MkRadio
|
|
},
|
|
props: {
|
|
modelValue: {
|
|
required: false
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
value: this.modelValue,
|
|
}
|
|
},
|
|
watch: {
|
|
value() {
|
|
this.$emit('update:modelValue', this.value);
|
|
}
|
|
},
|
|
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))
|
|
]);
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.novjtcto {
|
|
margin: 32px 0;
|
|
|
|
&:first-child {
|
|
margin-top: 0;
|
|
}
|
|
|
|
&:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
}
|
|
</style>
|