From e8005c8d3a6edf2c8cdce3fe098fb9acff8a57c6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 28 Nov 2021 20:07:37 +0900 Subject: client: refine ui --- packages/client/src/components/form/radios.vue | 49 ++++++++++++++++++++------ 1 file changed, 39 insertions(+), 10 deletions(-) (limited to 'packages/client/src/components/form/radios.vue') diff --git a/packages/client/src/components/form/radios.vue b/packages/client/src/components/form/radios.vue index 998a738202..ff5d51f9c7 100644 --- a/packages/client/src/components/form/radios.vue +++ b/packages/client/src/components/form/radios.vue @@ -23,6 +23,8 @@ export default defineComponent({ }, render() { let options = this.$slots.default(); + const label = this.$slots.label && this.$slots.label(); + const caption = this.$slots.caption && this.$slots.caption(); // なぜかFragmentになることがあるため if (options.length === 1 && options[0].props == null) options = options[0].children; @@ -30,12 +32,21 @@ export default defineComponent({ return h('div', { class: 'novjtcto' }, [ - ...options.map(option => h(MkRadio, { - key: option.key, - value: option.props.value, - modelValue: this.value, - 'onUpdate:modelValue': value => this.value = value, - }, option.children)) + ...(label ? [h('div', { + class: 'label' + }, [label])] : []), + h('div', { + class: 'body' + }, options.map(option => h(MkRadio, { + key: option.key, + value: option.props.value, + modelValue: this.value, + 'onUpdate:modelValue': value => this.value = value, + }, option.children)), + ), + ...(caption ? [h('div', { + class: 'caption' + }, [caption])] : []), ]); } }); @@ -43,12 +54,30 @@ export default defineComponent({ -- cgit v1.2.3-freya