uniapp 在鸿蒙系统上读取本地文件进行上传
2025-11-13 本文已影响0人
风规自远
const systemInfo = uni.getSystemInfoSync();
const os = systemInfo.osName;
if (os === 'harmonyos') {
uni.chooseFile({
success: (res) => {
const fileInfo = res.tempFiles[0]
selectedFile.value = {
path: fileInfo.path,
name: fileInfo.name,
size: fileInfo.size,
type: fileInfo.type
};
},
fail: (err) => {
uni.showToast({
title: '获取文件信息失败',
icon: 'none'
});
}
})
}