【报Bug】安卓 webview input file 不能设置accept为具体的格式比如.docx,不然点了之后就只显示相机
- Dominant language
- JavaScript
- Stars
- 41.6k
- Forks
- 3.7k
- Avg merge
- 7h 6m
- Merged PRs (30d)
- 6
Description
### 发行方式
App
### 具体平台
Android15
### 开发环境
macOS
### 项目创建方式
HBuilderX
### 依赖版本
HbuilderX4.66
### 问题描述
调用上传 AppUploadInstance.open()
弹出的文件选择里只有相机
```
export default {
data() {
return {
randomNum: 0,
};
},
onLoad() {},
methods: {
open() {
this.randomNum++;
},
eventEmit({ event, code, data }) {
console.log("eventEmit", { event, code, data });
this.$emit("change", { event, code, data });
},
},
};
export default {
data() {
return {
}
},
mounted() {
},
methods: {
openUpload( data, ownerVm) {
const { randomNum } = data
if(!randomNum) {
return;
}
console.log('data',data)
let fileInput = document.createElement('input')
fileInput.setAttribute('type', 'file')
fileInput.setAttribute('accept', '.txt,.md,.markdown,.pdf,.html,.xlsx,.xls,.docx,.csv,.eml,.msg,.pptx,.ppt,.xml,.epub')
fileInput.click()
fileInput.addEventListener('change', e => {
let file = e.target.files[0]
console.log(file)
})
},
callMethod(event, code, data){
this.$ownerInstance.callMethod('eventEmit', {event, code, data})
}
}
}
```
### 重现步骤
1. 调用上传 AppUploadInstance.open()
2. 弹出的文件选择里只有相机
### 期望行为
1. 调用上传 AppUploadInstance.open()
2. 弹出的文件选择里有文件管理器
### 实际行为
1. 调用上传 AppUploadInstance.open()
2. 弹出的文件选择里只有相机
### 截图或录屏
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.