import Clipboard from 'clipboard';
copyValue = () => {
let copyurl = document.getElementsByClassName('copy-btn');
const copy = new Clipboard(copyurl);
copy.on('success', (e) => {
message.success('复制成功');
});
copy.on('error', function (e) {
message.error('复制失败,请手动复制');
});
};
<Button data-clipboard-text={"分享链接:" + shareDetail.slkOfShare||链接 + ' 浏览器打开该链接查看内容'}
onClick={this.copyValue}
onMouseOver={this.mouseOver} className="btn copy-btn" type="primary">
复制链接
</Button>
复制Clipboard插件
最新推荐文章于 2024-06-14 09:46:41 发布