diff --git a/src/components/codeMirror/header.vue b/src/components/codeMirror/header.vue index 0de5ab0..a240c03 100644 --- a/src/components/codeMirror/header.vue +++ b/src/components/codeMirror/header.vue @@ -187,8 +187,7 @@ export default { range.setEndAfter(clipboardDiv.lastChild); window.getSelection().addRange(range); document.execCommand('copy'); - range.setStartBefore(clipboardDiv.firstChild); - range.setEndAfter(clipboardDiv.firstChild); + window.getSelection().removeAllRanges() fixCodeWhiteSpace('normal'); // 输出提示 this.$notify({