javascript - 如何使用 sweetalert2 上传多个文件
问题描述
我想上传多个文件,这段代码只选择一个文件上传
const { value: file } = await Swal.fire({
title: 'Select image',
input: 'file',
inputAttributes: {
'accept': 'image/*',
'aria-label': 'Upload your profile picture'
}
})
解决方案
您需要添加multiple
到您的输入
const { value: file } = await Swal.fire({
title: 'Select image',
input: 'file',
inputAttributes: {
'accept': 'image/*',
'multiple': 'multiple',
'aria-label': 'Upload your profile picture'
}
})
推荐阅读
- android - 已经存在:com.google.android.material.internal.package-info
- typescript - Chrome 开发工具 - 使用 TypeScript 时变量悬停不符合预期
- microsoft-teams - 如何在连接器设置中集成外部帐户
- elasticsearch - 如何在elasticsearch中找到分析字段中的重复词
- reactjs - 从 formik 向状态传递值
- mysql - Mysql选择总和等于的行
- html - Swift Regex 从页面 html 中检索令牌
- python - 获取变量 x 不是列表索引,而是列表中的实际值
- java - Java中的这个乘法有什么问题:27984 * 619246?
- spring-boot - 如何在春季测试中使用 liquibase 解决“已经有太多客户”的问题?