1.调用jquery 和 clipboard.min.js
2.<a id="copy" data-clipboard-action="copy" data-clipboard-target="绑定需要复制的选择器如#text1 .btn">复制</a>
3.
<script> var clipboard = new Clipboard('#copy'); clipboard.on('success', function(e) { console.log(e); $('#copy').html('复制成功'); }); clipboard.on('error', function(e) { console.log(e); }); </script>