问题描述
我有一个应用程序,在这个应用程序中我有用户系统,所以当我更改用户头像时,它在 web/android 平台中更改,但在 ios 平台中没有更改,我使用电容和cordova,所以请检查我的代码并帮助我解决我遇到的问题,以及我必须为 ios 平台放置哪些代码。
这是问题所在的屏幕截图 enter image description here 这是一些代码。 这是我的 app.component.ts
this.events.subscribe('avatar:change',(result) => {
if (result == 'ok') {
this.get('avatar').then(result => {
this.avatar = result;
});
}
});
}
这是change-avatar.html
<ion-content padding>
<input type="file" id="fileLoader" #fileLoader name="files" title="Load File" hidden />
<div class="modal">
<ion-row no-padding>
<ion-col size="8" offset="2">
<!--<ion-item>-->
<img id="checkinImage" [src]="uploadImage"/>
<!--<ion-avatar *ngIf="isAvatar()">
<img id="checkinImage" [src]="uploadImage"/>
</ion-avatar>
<ion-avatar *ngIf="isAvatarMiss()">
<img id="checkinImage" src='./assets/img/avatar.png'/>
</ion-avatar>
</ion-item>-->
<!--</span>-->
</ion-col>
</ion-row>
<ion-row no-padding>
<ion-col size="8" offset="2">
<button ion-button full (click)="presentActionSheet(fileLoader)">Escollir nou avatar</button>
<button margin-top ion-button full (click)="changeDone()">Aplicar</button>
<button margin-top ion-button full (click)="openPrefsPage()">EL MEU PERFIL D'USUARI</button>
</ion-col>
</ion-row>
</div>
这里是change-avatar.ts
presentActionSheet(fileLoader) {
this.avatarMiss = false;
this.avatarLoaded = true;
fileLoader.click();
let that = this;
fileLoader.onchange = function () {
let file = fileLoader.files[0];
let reader = new FileReader();
reader.onload = function(event) {
that.uploadImage = reader.result as string;
that.set('avatar',that.uploadImage);
console.log('image',that.uploadImage);
};
/*
reader.addEventListener(
'load',function () {
that.uploadImage = reader.result as string;
that.set('avatar',that.uploadImage);
// console.log(that.uploadImage);
},false);
*/
if (file) {
reader.readAsDataURL(file);
}
// that.events.publish('avatar:change','ok');
};
}
changeDone() {
this.events.publish('avatar:change','ok');
this.navCtrl.pop();
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)