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() })