HarmonyOS引导页登陆页以及tabbar的代码说明 登陆页2

这篇具有很好参考价值的文章主要介绍了HarmonyOS引导页登陆页以及tabbar的代码说明 登陆页2。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

鸿蒙 引导页,鸿蒙开发,HarmonyOS,ArkTS
代码:这里的prompt.showToast是弹出提示,@Extend(TextInput) 的功能是对TextInput做了公用的样式。isShowProgress是用来控制isShowProgress,出来一个等待效果
`

import prompt from ‘@ohos.promptAction’;
import router from ‘@ohos.router’;
import CommonConstants from ‘…/common/constants/CommonConstants’;
/**

  • 样式TextInput
    /
    @Extend(TextInput)
    function inputStyle() {
    .placeholderColor( r ( ′ a p p . c o l o r . p l a c e h o l d e r c o l o r ′ ) ) . h e i g h t ( r('app.color.placeholder_color')) .height( r(app.color.placeholdercolor)).height(r(‘app.float.login_input_height’))
    .fontSize( r ( ′ a p p . f l o a t . b i g t e x t s i z e ′ ) ) . b a c k g r o u n d C o l o r ( r('app.float.big_text_size')) .backgroundColor( r(app.float.bigtextsize)).backgroundColor(r(‘app.color.background’))
    .width(CommonConstants.FULL_PARENT)
    .padding({ left: CommonConstants.INPUT_PADDING_LEFT })
    .margin({ top: $r(‘app.float.input_margin_top’) })
    }
    /
    *
  • 样式
    */
    @Extend(Line)
    function lineStyle() {
    .width(CommonConstants.FULL_PARENT)
    .height( r ( ′ a p p . f l o a t . l i n e h e i g h t ′ ) ) . b a c k g r o u n d C o l o r ( r('app.float.line_height')) .backgroundColor( r(app.float.lineheight)).backgroundColor(r(‘app.color.line_color’))
    }

@Extend(Text)
function blueTextStyle() {
.fontColor( r ( ′ a p p . c o l o r . l o g i n b l u e t e x t c o l o r ′ ) ) . f o n t S i z e ( r('app.color.login_blue_text_color')) .fontSize( r(app.color.loginbluetextcolor)).fontSize(r(‘app.float.small_text_size’))
.fontWeight(FontWeight.Medium)
}

/**

  • 登陆界面
    */
    @Entry
    @Component
    struct LoginPage {
    @State account: string = ‘’;
    @State password: string = ‘’;
    @State isShowProgress: boolean = false;
    private timeOutId: number = -1;

@Builder
imageButton(src: Resource) {
Button({ type: ButtonType.Circle, stateEffect: true }) {
Image(src)
}
.height( r ( ′ a p p . f l o a t . o t h e r l o g i n i m a g e s i z e ′ ) ) . w i d t h ( r('app.float.other_login_image_size')) .width( r(app.float.otherloginimagesize)).width(r(‘app.float.other_login_image_size’))
.backgroundColor($r(‘app.color.background’))
}

login(): void {
if (this.account === ‘’ || this.password === ‘’) {
prompt.showToast({
message: ‘输入帐号密码不能为空’
})
} else {
this.isShowProgress = true;
if (this.timeOutId === -1) {
this.timeOutId = setTimeout(() => {
this.isShowProgress = false;
this.timeOutId = -1;
router.pushUrl({ url: ‘pages/MainPage’ });
}, CommonConstants.LOGIN_DELAY_TIME);
}
}
}

aboutToDisappear() {
clearTimeout(this.timeOutId);
this.timeOutId = -1;
}

build() {
Column() {
Image( r ( ′ a p p . m e d i a . i m g ′ ) ) . w i d t h ( r('app.media.img')) .width( r(app.media.img)).width(r(‘app.float.logo_image_size’))
.height($r(‘app.float.logo_image_size’))
.margin({ top: $r(‘app.float.logo_margin_top’), bottom: KaTeX parse error: Expected 'EOF', got '}' at position 35: …argin_bottom') }̲) Text(r(‘app.string.login_page’))
.fontSize( r ( ′ a p p . f l o a t . p a g e t i t l e t e x t s i z e ′ ) ) . f o n t W e i g h t ( F o n t W e i g h t . M e d i u m ) . f o n t C o l o r ( r('app.float.page_title_text_size')) .fontWeight(FontWeight.Medium) .fontColor( r(app.float.pagetitletextsize)).fontWeight(FontWeight.Medium).fontColor(r(‘app.color.title_text_color’))
Text( r ( ′ a p p . s t r i n g . l o g i n m o r e ′ ) ) . f o n t S i z e ( r('app.string.login_more')) .fontSize( r(app.string.loginmore)).fontSize(r(‘app.float.normal_text_size’))
.fontColor($r(‘app.color.login_more_text_color’))
.margin({ bottom: $r(‘app.float.login_more_margin_bottom’), top: $r(‘app.float.login_more_margin_top’) })

  TextInput({ placeholder: $r('app.string.account') })
    .maxLength(CommonConstants.INPUT_ACCOUNT_LENGTH)
    .type(InputType.Number)
    .inputStyle()
    .onChange((value: string) => {
      this.account = value;
    })
  Line().lineStyle()

  TextInput({ placeholder: $r('app.string.password') })
    .maxLength(CommonConstants.INPUT_PASSWORD_LENGTH)
    .type(InputType.Password)
    .inputStyle()
    .onChange((value: string) => {
      this.password = value;
    })
  Line().lineStyle()

  Row() {
    Text($r('app.string.message_login')).blueTextStyle()
    Text($r('app.string.forgot_password')).blueTextStyle()
  }
  .justifyContent(FlexAlign.SpaceBetween)
  .width(CommonConstants.FULL_PARENT)
  .margin({ top: $r('app.float.forgot_margin_top') })

  Button($r('app.string.login'), { type: ButtonType.Capsule })
    .width(CommonConstants.BUTTON_WIDTH)
    .height($r('app.float.login_button_height'))
    .fontSize($r('app.float.normal_text_size'))
    .fontWeight(FontWeight.Medium)
    .backgroundColor($r('app.color.login_button_color'))
    .margin({ top: $r('app.float.login_button_margin_top'), bottom: $r('app.float.login_button_margin_bottom') })
    .onClick(() => {
      this.login();
    })
  Text($r('app.string.register_account'))
    .fontColor($r('app.color.login_blue_text_color'))
    .fontSize($r('app.float.normal_text_size'))
    .fontWeight(FontWeight.Medium)

  if (this.isShowProgress) {
    LoadingProgress()
      .color($r('app.color.loading_color'))
      .width($r('app.float.login_progress_size'))
      .height($r('app.float.login_progress_size'))
      .margin({ top: $r('app.float.login_progress_margin_top') })
  }

  Blank()
  Text($r('app.string.other_login_method'))
    .fontColor($r('app.color.other_login_text_color'))
    .fontSize($r('app.float.little_text_size'))
    .fontWeight(FontWeight.Medium)
    .margin({ top: $r('app.float.other_login_margin_top'), bottom: $r('app.float.other_login_margin_bottom') })
  Row({ space: CommonConstants.LOGIN_METHODS_SPACE }) {
    this.imageButton($r('app.media.login_method1'))
    this.imageButton($r('app.media.login_method2'))
    this.imageButton($r('app.media.login_method3'))
  }
}
.backgroundColor($r('app.color.background'))
.height(CommonConstants.FULL_PARENT)
.width(CommonConstants.FULL_PARENT)
.padding({
  left: $r('app.float.page_padding_hor'),
  right: $r('app.float.page_padding_hor'),
  bottom: $r('app.float.login_page_padding_bottom')
})

}
}`文章来源地址https://www.toymoban.com/news/detail-774209.html

到了这里,关于HarmonyOS引导页登陆页以及tabbar的代码说明 登陆页2的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 非华为机型如何体验HarmonyOS鸿蒙系统 刷写HarmonyOS鸿蒙GSI系统以及一些初步的bug修复

    最近很多视频网站有非华为机型使用HarmonyOS鸿蒙系统的演示。其实大都是刷了HarmonyOS鸿蒙系统gsi系统。体验还可以。有些刷入后bug较多。那么这些机型是如何刷写gsi?可以参考我以往帖子 安卓玩机搞机-----没有第三方包 刷写第三方各种GSI系统 体验非官方系统_gsi刷机包_安卓机

    2024年02月09日
    浏览(36)
  • 鸿蒙开发自定义tabbar,带中间凸起按钮

    今天要分享的是开发一个自定义tabbar,因为签了保密协议的缘故,所以本项目还是基于鸿蒙4.0。 先看效果图: 自己做的图标不太美观,大家见谅哈哈哈。 这种带中间凸起的tabbar在项目中非常常见,但是我研究了一下系统的tabbar是不支持这样设置的,所以我们就自己开发一个

    2024年04月17日
    浏览(23)
  • HarmonyOS NEXT应用开发案例——自定义TabBar

    介绍 本示例主要介绍了TabBar中间页面如何实现有一圈圆弧外轮廓以及TabBar页签被点击之后会改变图标显示,并有一小段动画效果。 效果图预览 使用说明 : 依次点击tabBar页面,除了社区图标之外,其它图标往上移动一小段距离。 实现思路 场景1:TabBar中间页面实现有一圈圆

    2024年03月14日
    浏览(40)
  • HarmonyOS 鸿蒙应用开发(十一、面向鸿蒙开发的JavaScript基础)

    ArkTS 是HarmonyOS(鸿蒙操作系统)原生应用开发的首选语言。它是用于构建用户界面的一种TypeScript方言,扩展了TypeScript以适应HarmonyOS生态系统的UI开发需求。ArkTS 融合了TypeScript的静态类型系统和现代UI框架的设计理念,为开发者提供了一种更安全高效的方式来编写HarmonyOS应用。

    2024年02月20日
    浏览(40)
  • 【HarmonyOS】开发一个可以看小姐姐的鸿蒙应用 鸿蒙开发入门

    先整张效果图,丑点是丑点,但可以用,买不起鸿蒙系统手机的我,只配用虚拟机。 要说目前最火的手机操作系统,要我来看的话那必然是鸿蒙无疑。16号刚刚结束了第五次鸿蒙内测,在看到这次的内测名单之后,居然有970的机器,这是不是说明俺这手里奋战了三年的荣耀

    2024年02月15日
    浏览(62)
  • HarmonyOS鸿蒙基于Java开发: 相机开发

    目录 相机开发流程 接口说明 相机权限申请 相机设备创建 相机设备配置 相机帧捕获 相机设备释放 相机模块主要工作是给相机应用开发者提

    2024年01月20日
    浏览(42)
  • 鸿蒙开发-HarmonyOS UI架构

    当我们新建一个工程之后,首先会进入Index页。我们先简单的做一个文章列表的显示 这样,我们只要把 articles 里面填充数据,就能正常显示一个列表了。 可以看到上面的代码里是没有数据的,只有一个空数组。我们想要从网络获取数据。那么,数据怎么来呢?最简单粗暴的

    2024年02月19日
    浏览(37)
  • 鸿蒙(HarmonyOS)应用开发指南

    1.1 简介 鸿蒙 (即 HarmonyOS ,开发代号 Ark ,正式名称为华为终端鸿蒙智能设备操作系统软件)是华为公司自 2012 年以来开发的一款可支持鸿蒙原生应用和兼容 AOSP 应用的 分布式操作系统 。该系统利用“分布式”技术将 手机、电脑、平板、电视、汽车和智能穿戴 等多款设备

    2024年02月02日
    浏览(47)
  • 鸿蒙学习:初探HarmonyOS前端开发

    随着鸿蒙操作系统(HarmonyOS)的推出,前端开发者们迫切希望了解如何在这个全新的操作系统上进行应用程序的开发。本文将带您深入了解HarmonyOS前端开发的基础知识和相关源代码示例。 HarmonyOS是华为推出的一款基于微内核的分布式操作系统,旨在为各种设备提供统一的开发

    2024年01月21日
    浏览(30)
  • 鸿蒙应用开发尝鲜:初识HarmonyOS

    来源:华为官方网站 : https://developer.huawei.com/ 相信大家对鸿蒙应用开发也不在陌生,很多身处互联网行业或者不了解的人们现在也一定都听说过华为鸿蒙.这里我将不再说废话,直接步入正题 HarmonyOS应用开发采用的是ArkTS语言,ArkTS是在TypeScript(简称TS)基础上的拓展,而TS又是JavaScrip

    2024年02月02日
    浏览(50)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包