This commit is contained in:
Your Name
2026-08-11 17:41:36 +08:00
parent cfe4c82c90
commit 03fe4ddf9d
18771 changed files with 3617239 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
exports = function() {
var options =
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return new Promise(function(resolve) {
var input = document.createElement('input');
input.style.position = 'fixed';
input.style.bottom = '0';
input.style.left = '0';
input.style.visibility = 'hidden';
input.setAttribute('type', 'file');
if (options.accept) {
input.setAttribute('accept', options.accept);
}
if (options.multiple) {
input.setAttribute('multiple', '');
}
document.body.appendChild(input);
input.addEventListener('change', function() {
document.body.removeChild(input);
resolve(input.files);
});
input.click();
});
};
module.exports = exports;