Fix the issue of unable to copy code blocks in new messages.

This commit is contained in:
Rafi
2023-04-06 10:17:15 +08:00
parent 6522536291
commit 3f3ab8c33b

View File

@@ -23,8 +23,10 @@ const contentHtml = ref('')
const contentElm = ref(null) const contentElm = ref(null)
watchEffect(() => { watchEffect(async () => {
contentHtml.value = props.message.message ? md.render(props.message.message) : '' contentHtml.value = props.message.message ? md.render(props.message.message) : ''
await nextTick()
bindCopyCodeToButtons()
}) })
const bindCopyCodeToButtons = () => { const bindCopyCodeToButtons = () => {
@@ -49,10 +51,7 @@ const bindCopyCodeToButtons = () => {
} }
onMounted(() => { onMounted(() => {
bindCopyCodeToButtons() console.log('mounted')
})
onUpdated(() => {
bindCopyCodeToButtons() bindCopyCodeToButtons()
}) })