I'm having stuck with Ionic apps. My problem is I want to refresh the root page after navigated from the other page by clicking the ion-back-button, I'm trying to use the ionic lifecycle events.
Anyone having issues with the ionViewDidEnter() too (like in my case)? As I know these lifecycle event function, it’s fired when entering a page, before it becomes the active one.
This is DOM elements when the QR page become active:
As you can see there …
单击ion-icon后,我尝试使用自定义 src进行更改ion-tab-button
我尝试过的,使用 (click) 事件触发功能并更改离子图标内的 [src]="..."
有什么合适的方法可以改变这种黑客风格吗?
HTML:
<ion-tabs>
<ion-tab-bar slot="bottom">
<ion-tab-button tab="news/home" (click)="changeNewsIcon()">
<ion-icon [src]="newsIcon"></ion-icon>
<ion-label class="tab-title">News</ion-label>
</ion-tab-button>
<ion-tab-button tab="user" (click)="changeSearchIcon()">
<ion-icon [src]="searchIcon"></ion-icon>
<ion-label class="tab-title">Search</ion-label>
</ion-tab-button>
<ion-tab-button tab="networking" (click)="changeNetworkIcon()">
<ion-icon [src]="notiIcon"></ion-icon>
<ion-label class="tab-title">Networking</ion-label>
</ion-tab-button>
<ion-tab-button tab="chat" (click)="changeChatIcon()">
<ion-icon [src]="chatIcon"></ion-icon>
<ion-label class="tab-title">Chat</ion-label>
</ion-tab-button>
<ion-tab-button tab="profile" (click)="changeProfIcon()">
<ion-icon [src]="profIcon"></ion-icon>
<ion-label class="tab-title">Profile</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
Run Code Online (Sandbox Code Playgroud)
TS :
newsIcon = './assets/tabs/home.svg';
searchIcon = './assets/tabs/search.svg';
notiIcon = './assets/tabs/group.svg';
chatIcon = './assets/tabs/chat.svg';
profIcon = './assets/tabs/user.svg';
changeNewsIcon(): void {
// change news icon …Run Code Online (Sandbox Code Playgroud)