1. //传文本内容
    2. copy(text) {
    3. var input = document.createElement('input');
    4. input.setAttribute('readonly', 'readonly'); // 防止手机上弹出软键盘
    5. input.setAttribute('value', text);
    6. document.body.appendChild(input);
    7. // input.setSelectionRange(0, 9999);
    8. input.select();
    9. var res = document.execCommand('copy');
    10. document.body.removeChild(input);
    11. return res;
    12. }