// 是否支持复制
export const issupportcopy = ((!!document.querycommandsupported) && document.querycommandsupported('copy'));
const copytempelement = document.createelement('textarea');
copytempelement.setattribute('style', 'margin:0;padding:0;width:0;height:0;position:absolute;');
document.body.appendchild(copytempelement);
// 复制文本到剪切板
export function copytext(text) {
let succeeded;
try {
copytempelement.value = text;
copytempelement.select();
succeeded = document.execcommand('copy');
} catch (err) {
succeeded = false;
}
return succeeded;
}