userImg() {
let that = this
uni.chooseMedia({
count: 1,
mediaType: ['image', 'video'],
sourceType: ['album', 'camera'],
maxDuration: 30,
camera: 'back',
success(res) {
console.log(res.tempFiles[0].tempFilePath)
that.imagUrl = res.tempFiles[0].tempFilePath
}
})
},
直接调用api即可,注意的是要把值赋给你需要的,this指向需要注意一下