本文主要是介绍uni.chooseImage l临时路径IOS 退出软件之后失效异常,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
// 选择相册图片
tapPic() {
this.gData.openMedia = true;
uni.chooseImage({
count: 1, // 图片数量
sizeType:[‘compressed’], //压缩图
sourceType: [‘album’], //从相册选择
success: (res) => {
console.log(res)
if (res.tempFilePaths.length > 0) {let path = res.tempFilePaths[0];uni.saveFile({tempFilePath: path,success: (res) =>{var savedFilePath = res.savedFilePath;//检查文件是否已存在plus.io.resolveLocalFileSystemURL(savedFilePath,(entry)=> {console.log(entry.fullPath)try{let photoPath = "file://"+entry.fullPath;console.log(photoPath)for(let bgitem of this.bgList) {bgitem.checked = false;}this.bgList.push({url: photoPath,value: this.bgList[this.bgList.length - 1].value + 2,checked: true})this.photoList.push({url: photoPath,value: this.bgList[this.bgList.length - 1].value + 2,checked: false})this.$storage.editSet(this.backKey, photoPath);uni.setStorageSync(this.key, JSON.stringify(this.photoList));uni.$emit("editChatBack");}catch(e){console.log(e)//TODO handle the exception}//如果文件存在}, function (e) {});}});}}});},
这篇关于uni.chooseImage l临时路径IOS 退出软件之后失效异常的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!