This commit is contained in:
parent
89f0ae2523
commit
487db864ed
22
commont.js
22
commont.js
|
@ -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},
|
||||
{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;
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "erp-element-ui",
|
||||
"version": "1.0.50",
|
||||
"version": "1.0.51",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
Loading…
Reference in New Issue