feat: 新增设置系统剪贴板的内容工具函数

This commit is contained in:
h_mo 2022-10-06 21:28:30 +08:00
parent 75dfdf4911
commit b7ccd95e9b

View File

@ -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);
},
});
});
};