summaryrefslogtreecommitdiff
path: root/src/client/components/form/select.vue
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/components/form/select.vue')
-rw-r--r--src/client/components/form/select.vue34
1 files changed, 17 insertions, 17 deletions
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,