news 2026/7/2 12:37:12

6.10鸿蒙

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
6.10鸿蒙

@Entry
@Component
struct TextInputDemo {
build() {
Column({ space: 30 }) {
Text('用户登录')
.fontSize(28)
.fontWeight(FontWeight.Bold)

TextInput({ placeholder: "请输入学号/手机号码" })
.width(320)
.height(50)
.backgroundColor(0xf5f5f5)
.fontSize(20)
.borderRadius(10)

TextInput({ placeholder: "请输入密码" })
.type(InputType.Password)
.width(320)
.height(50)
.backgroundColor(0xf5f5f5)
.fontSize(20)
.borderRadius(10)

Row({ space: 20 }) {
Button('登录')
.height(50)
.width(100)
.fontSize(25)

Button('注册')
.height(50)
.width(100)
.fontSize(25)
}
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
}
}

效果图

二、信息操作界面

@Entry
@Component
struct ButtonDemo1{
build() {
Column({space:30}){
//常见的,用于登录、提交的按钮
Button("确认提交")
.width(300)
.height(50)
.backgroundColor(0x007DFF)
.fontSize(20)
.borderRadius(8)
//灰色按钮,用于取消/返回使用
Row({space:10}){
Button("取消操作")
.width(150)
.height(50)
.backgroundColor(0x999999)
.fontSize(20)
.borderRadius(8)

Button("删除数据")
.width(150)
.height(50)
.backgroundColor(Color.Red)
.fontSize(20)
.borderRadius(8)
}
}
.height('100%')
.width('100%')
.justifyContent(FlexAlign.Center)
}
}

三、个人信息

@Entry
@Component
struct TextInputDemo {
build() {
Column({ space: 30 }) {
Text('完善个人信息')
.fontSize(28)
.fontWeight(FontWeight.Bold)

TextInput({ placeholder: "姓名" })
.width(320)
.height(50)
.backgroundColor(0xf5f5f5)
.fontSize(20)
.borderRadius(10)

TextInput({ placeholder: "班级" })
.width(320)
.height(50)
.backgroundColor(0xf5f5f5)
.fontSize(20)
.borderRadius(10)

TextInput({ placeholder: "联系方式" })
.width(320)
.height(50)
.backgroundColor(0xf5f5f5)
.fontSize(20)
.borderRadius(10)
/*
Row({ space: 20 }) {
Button('确定')
.height(50)
.width(100)
.fontSize(25)

Button('注册')
.height(50)
.width(100)
.fontSize(25)

}
*/
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
}
}

四、注册界面

@Entry
@Component
struct TextInputDemo {
build() {
Column({ space: 30 }) {
Text('用户注册')
.fontSize(28)
.fontWeight(FontWeight.Bold)

TextInput({ placeholder: "请输入学号/手机号码" })
.width(320)
.height(50)
.backgroundColor(0xf5f5f5)
.fontSize(20)
.borderRadius(10)

TextInput({ placeholder: "请输入密码" })
.type(InputType.Password)
.width(320)
.height(50)
.backgroundColor(0xf5f5f5)
.fontSize(20)
.borderRadius(10)

TextInput({ placeholder: "请再次输入密码" })
.type(InputType.Password)
.width(320)
.height(50)
.backgroundColor(0xf5f5f5)
.fontSize(20)
.borderRadius(10)

}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Center)
}
}

五、:轮播展示

import { radio } from '@kit.TelephonyKit'

@Entry
@Component
struct TextInputDemo {
build() {
Column({ space: 30 }) {
Text('河北软件职业技术学院')
.fontSize(28)
.fontWeight(FontWeight.Bold)

// 本地图片轮播 1.jpg ~ 5.jpg
Swiper() {
Image($r("app.media.1")).width('100%').height('200%').objectFit(ImageFit.Cover)
Image($r("app.media.2")).width('100%').height('200%').objectFit(ImageFit.Cover)
Image($r("app.media.3")).width('100%').height('200%').objectFit(ImageFit.Cover)
Image($r("app.media.4")).width('100%').height('200%').objectFit(ImageFit.Cover)
Image($r("app.media.5")).width('100%').height('200%').objectFit(ImageFit.Cover)
}
.width('100%')
.height(180)
.autoPlay(true)
.loop(true)
.interval(3000)
.borderRadius(25)
.shadow({radius:100,color:0xcccccc,offsetX:2,offsetY:2})
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Center)
}
}

六、个人中心界面

@Entry
@Component
struct UserCardDemo{
build() {
Column({space:20}){
Text("欢迎来到我的个人中心")
.fontSize(30)
.fontWeight(FontWeight.Bolder)

Row({space:20}){
Image($r('app.media.1'))
.width('50%')
.borderRadius(100)

Text('QY-T')
.width('30%')
.fontSize(30)
}
.height(100)
.width('100%')
.padding({left:20})

}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
}
}

@Entry @Component struct Index { private videoCtrl: VideoController = new VideoController() build() { Column({ space: 40 }) { Text("本地视频播放器") .fontSize(24) .width("100%") .textAlign(TextAlign.Center) Video({ src: $rawfile("sd.mp4"), controller: this.videoCtrl, previewUri: $r("app.media.background") }) .width("100%") .height(220) .controls(false) .autoPlay(false) .loop(true) .muted(false) .objectFit(ImageFit.Contain) Row({ space: 30 }) { Button("播放") .onClick(() => { this.videoCtrl.start() }) Button("暂停") .onClick(() => { this.videoCtrl.pause() }) } } .width("100%") .height("100%") .padding(15) .justifyContent(FlexAlign.Center) } }
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/7/2 12:34:34

JMeter性能测试实战:从环境搭建到瓶颈定位的完整指南

1. 项目概述:为什么性能测试是项目交付前的“必考科目”如果你经历过线上系统在促销活动时突然卡死、新功能上线后服务器CPU飙升到100%、或者用户反馈“点一下要等半天”的尴尬场景,那你一定能理解性能测试的重要性。它绝不是开发流程中一个可选的“加分…

作者头像 李华
网站建设 2026/7/2 12:23:11

KMR221与TM4C1299NCZAD实现高精度电压管理方案

1. 项目概述:基于KMR221与TM4C1299NCZAD的电压管理系统 在工业自动化、新能源设备和精密仪器领域,电压管理一直是系统稳定性的关键命脉。传统方案往往面临响应速度慢、调节精度不足或成本过高的问题。最近我在一个光伏逆变器项目中,尝试将KMR…

作者头像 李华
网站建设 2026/7/2 12:22:14

移动端兼容性测试实战指南:从策略到自动化全链路解析

1. 项目概述:为什么移动端兼容性测试是“必修课”而非“选修课”干了这么多年移动端开发,我见过太多因为兼容性问题导致的线上事故了。一个功能在开发者的iPhone 14 Pro Max上跑得丝滑流畅,到了用户手里,可能因为一台老旧的Androi…

作者头像 李华
网站建设 2026/7/2 12:21:46

Koa2架构下的QQ音乐API服务设计与实现

Koa2架构下的QQ音乐API服务设计与实现 【免费下载链接】qq-music-api QQ 音乐API koa2实现 项目地址: https://gitcode.com/gh_mirrors/qq/qq-music-api 引言:模块化音乐服务架构的技术实践 在现代Web应用开发中,音乐服务API作为连接前端界面与后…

作者头像 李华