cliipblard.js 实现点击复制
<script src="js/clipboard.min.js"></script> <script type="text/javascript"> var clipboard = new Clipboard('.wechat-container',{ text: function(trigger) { return wxnum; } }); clipboard.on('success', function(e) { alert("微信号"+wxnum+"复制成功!"); window.location.href='weixin://'; }); clipboard.on('error', function(e) { console.log(e); alert('浏览器不支持复制功能,请手动长按复制!'); }); </script>