fix: index out of range on cancel

This commit is contained in:
Methapon Metanipat 2024-08-29 11:58:09 +07:00
parent 1b8393784b
commit c44dc9aaf3

View file

@ -55,6 +55,7 @@ function change(e: Event) {
const _file = _element?.files?.[0];
if (_file) {
currentIndex.value = file.length + 1;
const reader = new FileReader();
reader.readAsDataURL(_file);
reader.onload = () => {
@ -125,19 +126,6 @@ const { pdf, pages } = usePDF(computed(() => currentFile.value?.url));
@click="
() => {
currentIndexDropdownList = i;
currentIndex = file.length + 1;
// const _idx = file.findIndex(
// (v: any) => v.group === dropdownList?.[i].value,
// );
// if (_idx !== -1) {
// currentIndex = _idx;
// } else {
// file.push({
// group: dropdownList?.[i].value || 'other',
// });
// currentIndex = file.length - 1;
// }
browse();
}
"