function copyShareUrl(){ mui.plusReady(function(){ //復制鏈接到剪切板 var copy_content = ""; //判斷是安卓還是ios if(mui.os.ios){ //ios var UIPasteboard = plus.ios.importClass("UIPasteboard"); var generalPasteboard = UIPasteboard.generalPasteboard(); //設置/獲取文本內容: generalPasteboard.plusCallMethod({ setValue:copy_content, forPasteboardType: "public.utf8-plain-text" }); generalPasteboard.plusCallMethod({ valueForPasteboardType: "public.utf8-plain-text" }); }else{ //安卓 var context = plus.android.importClass("android.content.Context"); var main = plus.android.runtimeMainActivity(); var clip = main.getSystemService(context.CLIPBOARD_SERVICE); plus.android.invoke(clip,"setText",copy_content); } }); }
