Safari浏览器复制粘贴功能怎么做?IOS14。

如题。。。

跟电脑网页一样 只不过它会闪一下

求如何实现,现在ios14上不行,document.execCommand(‘copy’)一直返回false

var input = copyStr + ‘’;

    const el = document.createElement('input');

    el.value = input;

    el.setAttribute('readonly', '');

    // el.style.contain = 'strict';

    el.style.position = 'absolute';

    el.style.left = '-9999px';

    el.style.fontSize = '12pt'; // Prevent zooming on iOS

    const selection = getSelection();

    var originalRange = null;

    if (selection.rangeCount > 0) {

        originalRange = selection.getRangeAt(0);

    }

    document.body.appendChild(el);

    el.select();

    el.selectionStart = 0;

    el.selectionEnd = input.length;

    var success = false;

    try {

        success = document.execCommand('copy');

    } catch (err) {}

        document.body.removeChild(el);

    if (originalRange) {

        selection.removeAllRanges();

        selection.addRange(originalRange);

    }

    if(success){

        alert("复制成功");

    }else{

        alert("复制失败");

    }

解决了吗?

https://gitee.com/yeshao2069/CocosCreatorDemos/tree/v3.6.x/demo/2dP1/Creator3.6.0_CopyFile
试试

要升级到3.6