File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 10941094 <div v-if =" currentVersion?.review_state === 1" class =" flex items-center gap-1" >
10951095 <span class =" text-green-500" >{{ t('community.detail.positive') }}</span >
10961096 <span class =" text-gray-500" >{{
1097- currentVersion?.review_at ? currentVersion?.review_at?.replace(/-/g, '') : ''
1097+ currentVersion?.review_at
1098+ ? currentVersion?.review_at?.replace(/-/g, '/').split(' ')[0]
1099+ : ''
10981100 }}</span >
10991101 </div >
11001102 <span v-else class =" text-red-500" > {{ t('community.detail.negative') }} </span >
Original file line number Diff line number Diff line change 7676</template >
7777
7878<script setup>
79- import { ref , onMounted } from ' vue'
79+ import { ref , onMounted , watch } from ' vue'
8080 import screenfull from ' screenfull'
8181 import highlight from ' highlight.js'
8282 import prettier from ' prettier'
162162 const text = ref (props .modelValue )
163163 const emit = defineEmits ([' update:modelValue' , ' isUploading' ])
164164
165+ // 修复handleInput函数中的bug
165166 const handleInput = () => {
166- emit (' update:modelValue' , text)
167+ emit (' update:modelValue' , text . value )
167168 }
168169
170+ // 添加watch监听,确保所有值变化都会触发update:modelValue
171+ watch (
172+ text,
173+ newValue => {
174+ emit (' update:modelValue' , newValue)
175+ },
176+ { immediate: false }
177+ )
178+
179+ // 监听props.modelValue的变化,确保双向绑定正确工作
180+ watch (
181+ () => props .modelValue ,
182+ newValue => {
183+ if (newValue !== text .value ) {
184+ text .value = newValue
185+ }
186+ }
187+ )
188+
169189 const handleKeydown = event => {
170190 if (BLOCKED_KEYS .includes (event .key )) {
171191 event .stopPropagation ()
Original file line number Diff line number Diff line change 913913 <div v-if =" currentVersion?.review_state === 1" class =" flex items-center gap-1" >
914914 <span class =" text-green-500" >{{ t('community.detail.positive') }}</span >
915915 <span class =" text-gray-500" >{{
916- currentVersion?.review_at ? currentVersion?.review_at?.replace(/-/g, '') : ''
916+ currentVersion?.review_at
917+ ? currentVersion?.review_at?.replace(/-/g, '/').split(' ')[0]
918+ : ''
917919 }}</span >
918920 </div >
919921 <span v-else class =" text-red-500" > {{ t('community.detail.negative') }} </span >
Original file line number Diff line number Diff line change 1- 1.2.24
1+ 1.2.25
You can’t perform that action at this time.
0 commit comments