鸿蒙 - 登录页面
·
import { user } from '../../../viewModel/type';
import { router } from '@kit.ArkUI';
@Entry
@Component
struct Login {
@State message: string = 'Hello World';
@State userName: string = ""
@State passWord: string = ""
build() {
Column({
space:10
}) {
TextInput({ placeholder: '请输入用户名', text: $$this.userName })
TextInput({ placeholder: '请输入密码', text: $$this.passWord }).type(InputType.Password)
Button('登录').onClick((event: ClickEvent) => {
if (this.userName == user.getName() && this.passWord == user.getpwd()) {
router.pushUrl({
url: 'pages/week3/day5/homePage'
})
} else {
AlertDialog.show({
message: '用户名或密码错误'
})
this.userName = ''
this.passWord = ''
}
})
Button('修改密码').onClick((event: ClickEvent) => {
router.pushUrl({
url: 'pages/week3/day5/ModifyPass'
})
})
Button('忘记密码').onClick((event: ClickEvent) => {
router.pushUrl({
url: "pages/week3/day5/forgetPWD"
})
})
}
.height('100%')
.width('100%')
}
}

更多推荐



所有评论(0)