复制

52 阅读1分钟
   <span @click.stop="end(completeAcNo)">复制</span>
   completeAcNo:"1223563"
   //复制账号
    end(text) {
    const tag = document.createElement("input");
    tag.style.position = 'fixed';
    tag.style.left = '9999px';
    tag.style.top = '9999px';
    tag.setAttribute('id', 'copy-input');
    tag.setAttribute('readonly', 'readonly');
    tag.value = text;
    document.getElementsByTagName('body')[0].appendChild(tag);
    document.getElementById('copy-input').select();
    document.execCommand('copy');
    document.getElementById('copy-input').remove();
    Toast.succeed("卡号复制成功")
    },