diff --git a/_server/vm.js b/_server/vm.js index 312507fa..1dd5136b 100644 --- a/_server/vm.js +++ b/_server/vm.js @@ -199,7 +199,8 @@ var copyMap = new Vue({ return; } try { - pout.select(); + pout.focus(); + pout.setSelectionRange(0, pout.value.length); document.execCommand("Copy"); tip.whichShow = 6; } catch (e) { diff --git a/libs/utils.js b/libs/utils.js index 13a9f677..31a03a5c 100644 --- a/libs/utils.js +++ b/libs/utils.js @@ -568,7 +568,8 @@ utils.prototype.copy = function (data) { textArea.style.background = 'transparent'; textArea.value = data; document.body.appendChild(textArea); - textArea.select(); + textArea.focus(); + textArea.setSelectionRange(0, textArea.value.length); var successful = false; try { successful = document.execCommand('copy');