其他分享
首页 > 其他分享> > html将内容复制到剪贴板

html将内容复制到剪贴板

作者:互联网

 var link = "https//www.test.com/shared?key=" + shareddata;
            const input = document.createElement('input');
            document.body.appendChild(input);
            input.setAttribute('value', link);
            input.select();
            if (document.execCommand('copy')) {
                document.execCommand('copy');
                layer.msg("复制成功,请手动分享链接")
            }
            document.body.removeChild(input);

标签:复制到,body,剪贴板,copy,execCommand,html,link,input,document
来源: https://blog.csdn.net/weixin_43950528/article/details/118324489