该插件依赖jquery,必须先引入jq包
引入该资源下来得js包<script src="__JS__/clipboard.min.js"></script>
demo:
var content = "http://www.chajianwo.com?parent_id=1"; var clipboard = new Clipboard('.invite', { text: function() { return content; } }); clipboard.on('success', function(e) { $.toast("复制成功"); }); clipboard.on('error', function(e) { console.log(e); });