2024-09-10 01:18:16
copy: {
type: 'even',
class: 'layui-btn-xs layui-btn-warm',
icon: 'layui-icon-add-circle-fine',
url: '#',
text: __('Copy'),
title: __('Copy'),
full:0,
width:'',
height:'',
hidden:false,
callback:async function (obj, row) {
var url = row.data.code
console.log(url)
var textarea = document.createElement('textarea');
textarea.value = url;
document.body.appendChild(textarea);
textarea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? '成功' : '失败';
console.log('链接已复制到剪贴板' + msg);
alert("链接已复制到剪贴板");
} catch (err) {
console.log('无法复制', err);
alert("无法复制");
}
document.body.removeChild(textarea);
},
},