function copyTicketCodes() {
if (!selectTickets.length) {
Toast(t`请选择车票`);
return;
}
const text = selectTickets.join('、');
let inputDom = document.createElement('input');
inputDom.value = text;
inputDom.type = 'text';
document.body.appendChild(inputDom);
selectText(inputDom, 0, text.length);
if (document.execCommand('copy')) {
document.execCommand('copy')
Toast(t`已复制到粘贴板`);
} else {
Toast(t`不兼容`);
}
inputDom.className = 'oInput';
inputDom.style.display = 'none';
}
function selectText(textbox, startIndex, stopIndex) {
if (textbox.createTextRange) {
var range = textbox.createTextRange();
range.collapse(true);
range.moveStart('character', startIndex);
range.moveEnd('character', stopIndex - startIndex);
range.select();
} else {
textbox.setSelectionRange(startIndex, stopIndex);
textbox.focus();
}
}