From 540e6e4f99f0116303dd37ad88586f1426c31644 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 31 Oct 2021 19:35:35 +0900 Subject: fix(client): ページ編集時のドロップダウンメニューなどが動作しない問題を修正 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/components/form/select.vue | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/client/components/form/select.vue b/src/client/components/form/select.vue index 9efaf02697..363b3515fa 100644 --- a/src/client/components/form/select.vue +++ b/src/client/components/form/select.vue @@ -150,26 +150,26 @@ export default defineComponent({ }); }; - for (const optionOrOptgroup of options) { - if (optionOrOptgroup.type === 'optgroup') { - const optgroup = optionOrOptgroup; - menu.push({ - type: 'label', - text: optgroup.props.label, - }); - for (const option of optgroup.children) { + const scanOptions = (options: VNode[]) => { + for (const vnode of options) { + if (vnode.type === 'optgroup') { + const optgroup = vnode; + menu.push({ + type: 'label', + text: optgroup.props.label, + }); + scanOptions(optgroup.children); + } else if (Array.isArray(vnode.children)) { // 何故かフラグメントになってくることがある + const fragment = vnode; + scanOptions(fragment.children); + } else { + const option = vnode; pushOption(option); } - } else if (Array.isArray(optionOrOptgroup.children)) { // 何故かフラグメントになってくることがある - const fragment = optionOrOptgroup; - for (const option of fragment.children) { - pushOption(option); - } - } else { - const option = optionOrOptgroup; - pushOption(option); } - } + }; + + scanOptions(options); os.popupMenu(menu, container.value, { width: container.value.offsetWidth, -- cgit v1.2.3-freya