因此,我使用选项卡页面上的注销按钮功能导航回到登录页面。不幸的是,当用户已经登录并注册时,我无法单击“退出”按钮
我尝试过身份验证功能来导航回登录
tabs.page.ts
import {Component, OnInit, ViewChild} from '@angular/core';
import {UserService} from '../user.service';
import {AngularFireAuth} from '@angular/fire/auth';
import { Router} from '@angular/router'
import {AngularFirestore} from '@angular/fire/firestore'
@Component({
selector: 'app-tabs',
templateUrl: 'tabs.page.html',
styleUrls: ['tabs.page.scss'],
})
export class TabsPage implements OnInit {
constructor(
public afAuth: AngularFireAuth,
public router: Router,
public afstore: AngularFirestore
) {}
ngOnInit() {
}
async logout() {
try {
this.afAuth.auth.signOut();
this.router.navigate(['/loginPage']);
} catch (error) {
console.log('Error', error);
}
}
}
tabs.page.html
<ion-item>
<ion-button ion-button color="danger" (click)="logout()" full>signOut
</ion-button>
</ion-item>
答案 0 :(得分:0)
您需要在其中放置<DataGridTextColumn Header="{lex:Loc material}"
Binding="{Binding Material}" Width="Auto" MinWidth="75"
ToolTipService.ShowDuration="99999" ToolTipService.InitialShowDelay="0">
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource MaterialDesignDataGridCell}">
<Setter Property="ToolTip">
<Setter.Value>
<Image Source="{Binding ProductImage}" Width="250" />
</Setter.Value>
</Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ProductImageExists}" Value="False">
<Setter Property="ToolTip" Value="{x:Null}" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
和 Item Type Price 1 Price 2 Price 3
1 A 400 200 -46
1 B 500 250 -62
1 C 600 300 0
。
Unique_Items variable value
1 A Price 1 400
1 B Price 1 500
1 C Price 1 600
1 A Price 2 200
1 B Price 2 250
1 C Price 2 300
1 A Price 3 -46
1 B Price 3 -62
1 C Price 3 0
或者,您也可以采用await
的写作风格:
async
否则,路由器将在async logout() {
try {
// add await here:
await this.afAuth.auth.signOut();
this.router.navigate(['/loginPage']);
} catch (error) {
console.log('Error', error);
}
}
完成运行之前重定向到下一页。