click(index) {
let sourceType = []
if (index == 0) {
sourceType.push('album')
}
else {
sourceType.push('camera')
}
let that = this
uni.chooseImage({
count: 1,
sourceType: sourceType,
success(res) {
console.log(res)
that.tempFilePath = res.tempFilePaths.length > 0?res.tempFilePaths[0]: ''
that.$emit('result', {name: that.title, content: res})
},
fail(err) {
console.log(err)
that.$emit('result', {name: that.title, content: err})
}
})
}

- 发布:2020-11-12 23:19
- 更新:2020-11-12 23:19
- 阅读:951
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 10.15.6
HBuilderX类型: 正式
HBuilderX版本号: 2.9.8
手机系统: iOS
手机系统版本号: IOS 14
手机厂商: 模拟器
手机机型: ipad air 2
页面类型: vue
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
pad 横屏模式下 使用 uni.chooseImage 从本地相册选择图片
click(index) {
let sourceType = []
if (index == 0) {
sourceType.push('album')
}
else {
sourceType.push('camera')
}
let that = this
uni.chooseImage({
count: 1,
sourceType: sourceType,
success(res) {
console.log(res)
that.tempFilePath = res.tempFilePaths.length > 0?res.tempFilePaths[0]: ''
that.$emit('result', {name: that.title, content: res})
},
fail(err) {
console.log(err)
that.$emit('result', {name: that.title, content: err})
}
})
}
pad 横屏模式下 使用 uni.chooseImage 从本地相册选择图片
click(index) {
let sourceType = []
if (index == 0) {
sourceType.push('album')
}
else {
sourceType.push('camera')
}
let that = this
uni.chooseImage({
count: 1,
sourceType: sourceType,
success(res) {
console.log(res)
that.tempFilePath = res.tempFilePaths.length > 0?res.tempFilePaths[0]: ''
that.$emit('result', {name: that.title, content: res})
},
fail(err) {
console.log(err)
that.$emit('result', {name: that.title, content: err})
}
})
}
预期结果:
pad 横屏模式下 使用 uni.chooseImage 从本地相册选择图片 方向应该是横屏的 不应该是 竖屏的样子
pad 横屏模式下 使用 uni.chooseImage 从本地相册选择图片 方向应该是横屏的 不应该是 竖屏的样子
实际结果:
pad 横屏模式下 使用 uni.chooseImage 从本地相册选择图片 方向是竖屏的样子
pad 横屏模式下 使用 uni.chooseImage 从本地相册选择图片 方向是竖屏的样子
bug描述:
pad 横屏模式下 使用 uni.chooseImage 从本地相册选择图片,弹出的界面是竖屏的,不会旋转为横屏
