提交 c088eda5 编写于 作者: D DCloud_LXH

chore: 检测文件选择是否为用户触发,改为警告提示

上级 cf39fc6b
......@@ -12,7 +12,7 @@
"uni.chooseVideo.cancel": "取消",
"uni.chooseVideo.sourceType.album": "从相册选择",
"uni.chooseVideo.sourceType.camera": "拍摄",
"uni.chooseFile.notUserActivation": "文件选择器对话框只能在用户激活时显示",
"uni.chooseFile.notUserActivation": "文件选择器对话框只能在用户激活时显示",
"uni.previewImage.cancel": "取消",
"uni.previewImage.button.save": "保存图像",
"uni.previewImage.save.success": "保存图像到相册成功",
......
......@@ -12,7 +12,7 @@
"uni.chooseVideo.cancel": "取消",
"uni.chooseVideo.sourceType.album": "從相冊選擇",
"uni.chooseVideo.sourceType.camera": "拍攝",
"uni.chooseFile.notUserActivation": "文件選擇器對話框只能在用戶激活時顯示",
"uni.chooseFile.notUserActivation": "文件選擇器對話框只能在用戶激活時顯示",
"uni.previewImage.cancel": "取消",
"uni.previewImage.button.save": "保存圖像",
"uni.previewImage.save.success": "保存圖像到相冊成功",
......
......@@ -57,11 +57,9 @@ export function chooseFile ({
// TODO 用户取消选择时,触发 fail,目前尚未找到合适的方法。
})
if (interact.getStatus()) {
fileInput.click()
} else {
invoke(callbackId, {
errMsg: `chooseFile:fail ${t('uni.chooseFile.notUserActivation')}`
})
fileInput.click()
if (!interact.getStatus()) {
console.warn(`${t('uni.chooseFile.notUserActivation')}`)
}
}
......@@ -55,11 +55,9 @@ export function chooseImage ({
// TODO 用户取消选择时,触发 fail,目前尚未找到合适的方法。
})
if (interact.getStatus()) {
imageInput.click()
} else {
invoke(callbackId, {
errMsg: `chooseImage:fail ${t('uni.chooseFile.notUserActivation')}`
})
imageInput.click()
if (!interact.getStatus()) {
console.warn(`${t('uni.chooseFile.notUserActivation')}`)
}
}
......@@ -69,11 +69,9 @@ export function chooseVideo ({
// TODO 用户取消选择时,触发 fail,目前尚未找到合适的方法。
})
if (interact.getStatus()) {
videoInput.click()
} else {
invoke(callbackId, {
errMsg: `chooseVideo:fail ${t('uni.chooseFile.notUserActivation')}`
})
videoInput.click()
if (!interact.getStatus()) {
console.warn(`${t('uni.chooseFile.notUserActivation')}`)
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册