invite.js 846 B

1234567891011121314151617181920212223242526272829
  1. ;
  2. layui.define(['form'], function (e) {
  3. var s = layui.$;
  4. var invite = function(){
  5. invite.prototype.loadclipboard(function(){
  6. var clipboard = new ClipboardJS('.layui-btn-copy');
  7. clipboard.on('success', function(e) {
  8. layer.msg('复制成功');
  9. e.clearSelection();
  10. });
  11. });
  12. }
  13. invite.prototype.loadclipboard = function(callback){
  14. var head = document.getElementsByTagName('head')[0];
  15. var script = document.createElement('script');
  16. script.type = 'text/javascript';
  17. script.src = '/static/plugins/clipboard/clipboard.min.js';
  18. script.onload = script.onreadystatechange = function () {
  19. if (!this.readyState || this.readyState === "loaded" || this.readyState === "complete"){
  20. callback();
  21. script.onload = script.onreadystatechange = null;
  22. }
  23. };
  24. head.appendChild(script);
  25. }
  26. e('invite',new invite())
  27. })