diff options
| author | かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> | 2025-01-04 15:06:03 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-04 06:06:03 +0000 |
| commit | f4e025170e43b29be5ce25e0d6de8da372c0a048 (patch) | |
| tree | 3d20d347df08727d3fed8917e70f3b207ced64e6 | |
| parent | pg_bigmが利用できるよう、ノートの検索をILIKE演算子でな... (diff) | |
| download | sharkey-f4e025170e43b29be5ce25e0d6de8da372c0a048.tar.gz sharkey-f4e025170e43b29be5ce25e0d6de8da372c0a048.tar.bz2 sharkey-f4e025170e43b29be5ce25e0d6de8da372c0a048.zip | |
fix(frontend/AiScript): Ui:C:selectの値が切り替わらない問題を修正 (#15184)
* fix(frontend/AiScript): Ui:C:selectの値が切り替わらない問題を修正
* Update Changelog
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | packages/frontend/src/components/MkAsUi.vue | 19 |
2 files changed, 15 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index fc0d1e89c5..435d67d008 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Fix: 公開範囲がホームのノートの埋め込みウィジェットが読み込まれない問題を修正 (Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/803) - Fix: 絵文字管理画面で一部の絵文字が表示されない問題を修正 +- Fix: `Ui:C:select`で値の変更が画面に反映されない問題を修正 ### Server - Fix: ユーザーのプロフィール画面をアドレス入力などで直接表示した際に概要タブの描画に失敗する問題の修正( #15032 ) diff --git a/packages/frontend/src/components/MkAsUi.vue b/packages/frontend/src/components/MkAsUi.vue index e52ab5ccad..365b767bd6 100644 --- a/packages/frontend/src/components/MkAsUi.vue +++ b/packages/frontend/src/components/MkAsUi.vue @@ -32,7 +32,7 @@ SPDX-License-Identifier: AGPL-3.0-only <template v-if="c.label" #label>{{ c.label }}</template> <template v-if="c.caption" #caption>{{ c.caption }}</template> </MkInput> - <MkSelect v-else-if="c.type === 'select'" :small="size === 'small'" :modelValue="c.default ?? null" @update:modelValue="c.onChange"> + <MkSelect v-else-if="c.type === 'select'" :small="size === 'small'" :modelValue="valueForSelect" @update:modelValue="onSelectUpdate"> <template v-if="c.label" #label>{{ c.label }}</template> <template v-if="c.caption" #caption>{{ c.caption }}</template> <option v-for="item in c.items" :key="item.value" :value="item.value">{{ item.text }}</option> @@ -77,8 +77,8 @@ import MkPostForm from '@/components/MkPostForm.vue'; const props = withDefaults(defineProps<{ component: AsUiComponent; components: Ref<AsUiComponent>[]; - size: 'small' | 'medium' | 'large'; - align: 'left' | 'center' | 'right'; + size?: 'small' | 'medium' | 'large'; + align?: 'left' | 'center' | 'right'; }>(), { size: 'medium', align: 'left', @@ -86,7 +86,7 @@ const props = withDefaults(defineProps<{ const c = props.component; -function g(id) { +function g(id: string) { const v = props.components.find(x => x.value.id === id)?.value; if (v) return v; @@ -122,13 +122,22 @@ const containerStyle = computed(() => { const valueForSwitch = ref('default' in c && typeof c.default === 'boolean' ? c.default : false); -function onSwitchUpdate(v) { +function onSwitchUpdate(v: boolean) { valueForSwitch.value = v; if ('onChange' in c && c.onChange) { c.onChange(v as never); } } +const valueForSelect = ref('default' in c && typeof c.default !== 'boolean' ? c.default ?? null : null); + +function onSelectUpdate(v) { + valueForSelect.value = v; + if ('onChange' in c && c.onChange) { + c.onChange(v as never); + } +} + function openPostForm() { const form = (c as AsUiPostFormButton).form; if (!form) return; |