不允许在离子中加载局部资源



我试图在离子中使用相机,它点击照片但不显示照片。

getCamera() {
this.camera.getPicture().then((res)=>{
this.imageURL = res;
console.log(this.imageURL);
}).catch(e=>{
console.log(e);
})
}

控制台显示我

不允许加载本地资源我试图在我的集合组件中使用imageURL,如

<img src={{imageURL}} alt="" height="200" width="200" />

Try This

const options: CameraOptions = {
quality: 90,
targetWidth: 350,
targetHeight: 350,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
sourceType: this.camera.PictureSourceType.CAMERA, // this.camera.PictureSourceType.SAVEDPHOTOALBUM
correctOrientation: true,
allowEdit: true
};
this.camera.getPicture(options).then((imageData) => {
if (imageData) {
this.imageURL = 'data:image/jpeg;base64,' + imageData;
}
}, (err) => {
});

最新更新