diff --git a/packages/common/Code/src/main.vue b/packages/common/Code/src/main.vue index 7cb8f66cb..6247406ae 100644 --- a/packages/common/Code/src/main.vue +++ b/packages/common/Code/src/main.vue @@ -57,9 +57,9 @@ export default { content } = this.generateCodeHTML(this.language, this.code, this.trim) if (valid) { - this.$el.innerHTML = content + this.$refs.code.innerHTML = content } else { - this.$el.textContent = content + this.$refs.code.textContent = content } } }, @@ -69,7 +69,11 @@ export default { class: { [`n-${this.synthesizedTheme}-theme`]: this.synthesizedTheme } - }) + }, [ + h('code', { + ref: 'code' + }) + ]) } }