This commit is contained in:
ln1778 2024-06-28 16:24:40 +08:00
parent 89f0ae2523
commit 487db864ed
2 changed files with 22 additions and 2 deletions

View File

@ -542,7 +542,27 @@ function promiseAllWithErrors(promises) {
}); });
} }
function onCopy(textToCopy){
return new Promise((r,j)=>{
// 使用 navigator.clipboard.writeText 方法(如果可用)
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(textToCopy).then(function() {
console.log('文本已成功复制到剪贴板');
r('复制成功');
}).catch(function(err) {
j('无法复制文本: ', err);
// 此处处理复制失败的情况
console.error('无法复制文本: ', err);
});
} else {
j('你的浏览器不支持 Clipboard API');
// 对于不支持 Clipboard API 的浏览器,你可以回退到其他方法,如使用 Flash 或第三方库
console.error('你的浏览器不支持 Clipboard API');
}
});
}
const commont=[{pagedata:pagedata},{maskData:maskData},{getDay:getDay},{uuid:uuid},{addStorage:addStorage},{getStorage:getStorage},{deloneStorage:deloneStorage},{delAllStorage:delAllStorage},{formatDate:formatDate},{jsonurldata:jsonurldata},{isWeiXin:isWeiXin}, const commont=[{pagedata:pagedata},{maskData:maskData},{getDay:getDay},{uuid:uuid},{addStorage:addStorage},{getStorage:getStorage},{deloneStorage:deloneStorage},{delAllStorage:delAllStorage},{formatDate:formatDate},{jsonurldata:jsonurldata},{isWeiXin:isWeiXin},
{getQueryString},{getMonthLast},{getMonthFirst},{compression},{isObject},{isArray},{addSessionStorage},{getSessionStorage},{delSessionStorage},{initOss},{setCookie}, {getQueryString},{getMonthLast},{getMonthFirst},{compression},{isObject},{isArray},{addSessionStorage},{getSessionStorage},{delSessionStorage},{initOss},{setCookie},
{getCookie},{delCookie:delCookie},{debunce},{promiseAllWithErrors}]; {getCookie},{delCookie:delCookie},{debunce},{promiseAllWithErrors},{onCopy:onCopy}];
export default commont; export default commont;

View File

@ -1,6 +1,6 @@
{ {
"name": "erp-element-ui", "name": "erp-element-ui",
"version": "1.0.50", "version": "1.0.51",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {