summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-10-23 11:17:41 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2021-10-23 11:17:41 +0900
commitc6afc61c94b3f3f18217443af722f12e5b0ccadb (patch)
tree7824b506de9047218ff7b73b68fbb2afe40aea4e /src/client
parent12.93.1 (diff)
downloadmisskey-c6afc61c94b3f3f18217443af722f12e5b0ccadb.tar.gz
misskey-c6afc61c94b3f3f18217443af722f12e5b0ccadb.tar.bz2
misskey-c6afc61c94b3f3f18217443af722f12e5b0ccadb.zip
fix(client): ウィジェットを追加できない問題を修正
Fix #7905
Diffstat (limited to 'src/client')
-rw-r--r--src/client/components/form/select.vue33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/client/components/form/select.vue b/src/client/components/form/select.vue
index 30ccfd312b..9efaf02697 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);
}
}