# file 工具集
文件相关操作工具在 @/utils/designUtil
# selectFiles
选择文件
accept
:文件类型,multiple
:是否可多选
import { selectFiles } from '@/utils/designUtil'
selectFiles({accept: '.png', multiple: false}).then((fileList) => {
})
# getImgStr
获取图片base64
import { selectFiles,getImgStr } from '@/utils/designUtil'
selectFiles({accept: '.png', multiple: false}).then((fileList) => {
for (const file of Array.from(fileList)) {
const str = getImgStr(file)
console.log('获取到的base64',str)
}
})
# downFile
前端下载文件
# getFileExt
获取文件后缀
# checkFileExt
判断文件类型是否在列表内
# toArrayBuffer
file转buffer
← font 字体