如何解决不允许在离子中加载本地资源
我正在尝试在 ionic 中使用相机,它点击照片但不显示照片。
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) => {
});
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。