press-ui
Version:
简单、易用的跨端组件库,兼容 Vue2 和 Vue3,同时支持 uni-app和普通 Vue 项目
22 lines (17 loc) • 473 B
JavaScript
import { fileToUrl } from '../utils/file';
export function watchChange(event, count) {
const tempFiles = [];
const fileCount = event.target.files.length;
for (let i = 0; i < fileCount; i++) {
const file = event.target.files[i];
let filePath;
Object.defineProperty(file, 'path', {
get() {
filePath = filePath || fileToUrl(file);
return filePath;
},
});
if (i < count) tempFiles.push(file);
}
return tempFiles;
}