123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- const inputElement = document.createElement('input');
- inputElement.type = 'file';
- export default function chooseFile(accept, mutiple) {
- return new Promise(async (resolve, reject) => {
-
- inputElement.accept = accept || '';
- inputElement.multiple = !!mutiple;
- inputElement.onchange = () => {
- const files = [...inputElement.files];
- inputElement.value = '';
- resolve(files);
- };
- inputElement.click();
-
-
- reject(new Error('此方法仅支持在H5平台调用'));
-
- });
- };
|