From b7ccd95e9b7be90ccc8992bd14c34eaedc7c162e Mon Sep 17 00:00:00 2001 From: h_mo <596417202@qq.com> Date: Thu, 6 Oct 2022 21:28:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=89=AA=E8=B4=B4=E6=9D=BF=E7=9A=84=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E5=B7=A5=E5=85=B7=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/uniapi/index.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/utils/uniapi/index.ts b/src/utils/uniapi/index.ts index e69de29..d31a000 100644 --- a/src/utils/uniapi/index.ts +++ b/src/utils/uniapi/index.ts @@ -0,0 +1,37 @@ +/** + * @description 设置系统剪贴板的内容 + * @param data 需要设置的内容 + * @param showToast 配置是否弹出提示,默认弹出提示 + * @constructor + */ +export const SetClipboardData = (data: string, showToast = true) => { + return new Promise((resolve, reject) => { + uni.setClipboardData({ + data: data, + showToast: showToast, + success: (res) => { + resolve(res); + }, + fail: (err) => { + reject(err); + }, + }); + }); +}; + +/** + * @description 获取系统剪贴板内容 + * @constructor + */ +export const GetClipboardData = () => { + return new Promise((resolve, reject) => { + uni.getClipboardData({ + success: (res) => { + resolve(res); + }, + fail: (err) => { + reject(err); + }, + }); + }); +};