From ea8ae121a42de4606e1939bd7499c92d6ebf1bd3 Mon Sep 17 00:00:00 2001 From: 07akioni <07akioni2@gmail.com> Date: Sun, 22 Dec 2019 14:10:37 +0800 Subject: [PATCH] refactor(code): add code tag in it --- packages/common/Code/src/main.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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' + }) + ]) } }