CutePet/Assets/Plugins/wx.jslib

17 lines
590 B
Plaintext
Raw Normal View History

2024-10-25 11:10:04 +08:00
mergeInto(LibraryManager.library, {
CopyToClipboardJS: function(text) {
// 将 Unity 中传递的 UTF8 字符串转换为 JavaScript 字符串
var copyText = UTF8ToString(text);
// 创建一个隐藏的textarea来临时存放要复制的内容
var textArea = document.createElement("textarea");
textArea.value = copyText;
document.body.appendChild(textArea);
textArea.select();
document.execCommand("copy");
document.body.removeChild(textArea);
console.log("Copied to clipboard: " + copyText);
}
});