fix textarea.select

textarea.select();
==> (ios support)
textarea.focus();
textarea.setSelectionRange(0, textarea.value.length);
This commit is contained in:
YouWei Zhao 2018-08-26 23:01:59 +08:00
parent 2273315f93
commit e69f248ea2
2 changed files with 4 additions and 2 deletions

View File

@ -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) {

View File

@ -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');