WinJS Clipboard
//剪贴板 方法1 window.uexClipboard = { copy: null, getContent: null, cbGetContent: null }; uexClipboard.copy = function (text) { if (!text) return; var dataPackage = new Windows.ApplicationModel.DataTransfer.DataPackage(); dataPackage.setText(text); Windows.ApplicationModel.DataTransfer.Clipboard.setContent(dataPackage); }; uexClipboard.getContent = function () { var dataPackageView = Windows.ApplicationModel.DataTransfer.Clipboard.getContent(); dataPackageView.getTextAsync().done(function completed(result) { if (typeof (uexClipboard.cbGetContent) === "function") { uexClipboard.cbGetContent("", 1, result); } }); } //方法2 window.uexClipboard = { copy: function (text) { if (!text) return; var dataPackage = new Windows.ApplicationModel.DataTransfer.DataPackage(); dataPackage.setText(text); Windows.ApplicationModel.DataTransfer.Clipboard.setContent(dataPackage); }, getContent: function () { var dataPackageView = Windows.ApplicationModel.DataTransfer.Clipboard.getContent(); dataPackageView.getTextAsync().done(function completed(result) { if (typeof (uexClipboard.cbGetContent) === "function") { uexClipboard.cbGetContent("", 1, result); } }); }, cbGetContent: null };