register.page.ts 649 B

1234567891011121314151617181920212223242526
  1. import { Component } from '@angular/core';
  2. import { Router } from '@angular/router';
  3. @Component({
  4.   selector: 'app-register',
  5.   templateUrl: 'register.page.html',
  6.   styleUrls: ['register.page.scss']
  7. })
  8. export class RegisterPage {
  9.   username: string='';
  10.   password: string='';
  11.   confirmPassword: string='';
  12.   registerFailed: boolean = false;
  13.   constructor(private router: Router) {}
  14.   register() {
  15.     // 真实项目中应该调用后端API进行用户注册
  16.     // 这里简单模拟注册成功
  17.     this.router.navigate(['/login']);
  18.   }
  19.   goToLogin() {
  20.     this.router.navigate(['/login']);
  21.   }
  22. }