From 431d48c7100a5966442c6de8d515183850c4186e Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Fri, 2 Sep 2022 11:32:38 +0800 Subject: [PATCH] chore(h5): setClipboardData --- packages/uni-h5/src/service/api/device/clipboard.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uni-h5/src/service/api/device/clipboard.ts b/packages/uni-h5/src/service/api/device/clipboard.ts index a67061c85..2238f3953 100644 --- a/packages/uni-h5/src/service/api/device/clipboard.ts +++ b/packages/uni-h5/src/service/api/device/clipboard.ts @@ -64,8 +64,8 @@ function _setClipboardData(data: string, resolve: Function, reject: Function) { textarea.style.zIndex = '-9999' document.body.appendChild(textarea) textarea.value = data - textarea.focus() textarea.select() + textarea.setSelectionRange(0, textarea.value.length) const result = document.execCommand('Copy', false) textarea.blur() if (result) { -- GitLab