Skip to content

Commit edb5ef6

Browse files
committed
share-target でデフォルトテキストが表示sれないバグの修正
1 parent 016a60a commit edb5ef6

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/components/ShareTarget/ShareTargetForm.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
label="投稿先チャンネル"
77
:options="channelOptions"
88
/>
9-
<share-target-message-input :class="[$style.item, $style.input]" />
9+
<share-target-message-input
10+
:class="[$style.item, $style.input]"
11+
:default-text="defaultTextRef"
12+
/>
1013
<form-button
1114
:class="[$style.item, $style.button]"
1215
label="送信"
@@ -34,6 +37,7 @@ import { useUsersStore } from '/@/store/entities/users'
3437
const props = defineProps<{
3538
defaultText: string
3639
}>()
40+
const defaultTextRef = computed(() => props.defaultText)
3741
3842
const emit = defineEmits<{
3943
(e: 'post'): void

src/components/ShareTarget/ShareTargetMessageInput.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
<textarea
88
:id="id"
99
ref="textareaRef"
10-
v-model="state.text"
1110
:class="$style.input"
11+
:value="defaultTextRef"
12+
@input="event => state.text = (event.target as HTMLTextAreaElement)?.value"
1213
/>
1314
</div>
1415
<div :class="$style.controls">
@@ -34,7 +35,7 @@
3435
import MessageInputFileList from '/@/components/Main/MainView/MessageInput/MessageInputFileList.vue'
3536
import MessageInputUploadButton from '/@/components/Main/MainView/MessageInput/MessageInputUploadButton.vue'
3637
import MessageInputInsertStampButton from '/@/components/Main/MainView/MessageInput/MessageInputInsertStampButton.vue'
37-
import { onMounted, shallowRef, ref, toRef } from 'vue'
38+
import { onMounted, shallowRef, computed, ref, toRef } from 'vue'
3839
import { randomString } from '/@/lib/basic/randomString'
3940
import useTextStampPickerInvoker from '../Main/MainView/composables/useTextStampPickerInvoker'
4041
import useAttachments from '../Main/MainView/MessageInput/composables/useAttachments'
@@ -45,6 +46,11 @@ import { useStampsStore } from '/@/store/entities/stamps'
4546
import { useStampPalettesStore } from '/@/store/entities/stampPalettes'
4647
import { useStampHistory } from '/@/store/domain/stampHistory'
4748
49+
const props = defineProps<{
50+
defaultText: string
51+
}>()
52+
const defaultTextRef = computed(() => props.defaultText)
53+
4854
const { fetchStampHistory } = useStampHistory()
4955
const { fetchStamps } = useStampsStore()
5056
const { fetchStampPalettes } = useStampPalettesStore()

0 commit comments

Comments
 (0)