From 3f3ab8c33b2231cb6b7f75235da2d5ef2879d43e Mon Sep 17 00:00:00 2001 From: Rafi Date: Thu, 6 Apr 2023 10:17:15 +0800 Subject: [PATCH] Fix the issue of unable to copy code blocks in new messages. --- components/MsgContent.vue | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/MsgContent.vue b/components/MsgContent.vue index 95ddba8..f622424 100644 --- a/components/MsgContent.vue +++ b/components/MsgContent.vue @@ -23,8 +23,10 @@ const contentHtml = ref('') const contentElm = ref(null) -watchEffect(() => { +watchEffect(async () => { contentHtml.value = props.message.message ? md.render(props.message.message) : '' + await nextTick() + bindCopyCodeToButtons() }) const bindCopyCodeToButtons = () => { @@ -49,10 +51,7 @@ const bindCopyCodeToButtons = () => { } onMounted(() => { - bindCopyCodeToButtons() -}) - -onUpdated(() => { + console.log('mounted') bindCopyCodeToButtons() })