diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c494fc53dd6b5063cadf47f745a5f1cbd921439..d407ee3ca653e75bbb698888814e0c2214ca9c3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ --> +## 12.x.x (unreleased) + +### Improvements + +### Bugfixes +- クライアント: ã‚¦ã‚£ã‚¸ã‚§ãƒƒãƒˆã‚’è¿½åŠ ã§ããªã„å•é¡Œã‚’ä¿®æ£ + ## 12.93.1 (2021/10/23) ### Bugfixes diff --git a/src/client/components/form/select.vue b/src/client/components/form/select.vue index 30ccfd312be569995b879096c757ccd3d05646a9..9efaf026973a994c969440e9f192c5c5a38d5737 100644 --- a/src/client/components/form/select.vue +++ b/src/client/components/form/select.vue @@ -24,7 +24,7 @@ </template> <script lang="ts"> -import { defineComponent, onMounted, onUnmounted, nextTick, ref, watch, computed, toRefs } from 'vue'; +import { defineComponent, onMounted, onUnmounted, nextTick, ref, watch, computed, toRefs, VNode } from 'vue'; import MkButton from '@client/components/ui/button.vue'; import * as os from '@client/os'; @@ -140,6 +140,16 @@ export default defineComponent({ const menu = []; let options = context.slots.default(); + const pushOption = (option: VNode) => { + menu.push({ + text: option.children, + active: v.value === option.props.value, + action: () => { + v.value = option.props.value; + }, + }); + }; + for (const optionOrOptgroup of options) { if (optionOrOptgroup.type === 'optgroup') { const optgroup = optionOrOptgroup; @@ -148,23 +158,16 @@ export default defineComponent({ text: optgroup.props.label, }); for (const option of optgroup.children) { - menu.push({ - text: option.children, - active: v.value === option.props.value, - action: () => { - v.value = option.props.value; - }, - }); + pushOption(option); + } + } else if (Array.isArray(optionOrOptgroup.children)) { // 何故ã‹ãƒ•ãƒ©ã‚°ãƒ¡ãƒ³ãƒˆã«ãªã£ã¦ãã‚‹ã“ã¨ãŒã‚ã‚‹ + const fragment = optionOrOptgroup; + for (const option of fragment.children) { + pushOption(option); } } else { const option = optionOrOptgroup; - menu.push({ - text: option.children, - active: v.value === option.props.value, - action: () => { - v.value = option.props.value; - }, - }); + pushOption(option); } }