手机网站与电脑网站兼容南城区仿做网站

张小明 2026/1/7 20:54:18
手机网站与电脑网站兼容,南城区仿做网站,怎么创建自己的网址,泉州网站建设-泉州网站建设公司核心功能#xff1a;添加单词#xff1a;输入英文单词和中文释义删除单词#xff1a;每个单词项都有删除按钮搜索功能#xff1a;实时搜索单词或释义统计信息#xff1a;显示单词总数界面特点#xff1a;简洁的Material Design风格两种视图模式#xff1a;列表视图和添加…核心功能添加单词输入英文单词和中文释义删除单词每个单词项都有删除按钮搜索功能实时搜索单词或释义统计信息显示单词总数界面特点简洁的Material Design风格两种视图模式列表视图和添加视图响应式布局适配不同屏幕实时搜索过滤添加示例单词按钮使用说明点击添加新单词切换到添加视图输入英文单词和中文释义点击添加单词保存在列表视图中可以删除单词或搜索单词完整代码// WordsLibrary.ets import { promptAction } from ohos.promptAction; import { display } from ohos.display; // 定义单词数据模型 class WordItem { id: number; word: string; meaning: string; date: string; constructor(id: number, word: string, meaning: string) { this.id id; this.word word; this.meaning meaning; this.date new Date().toLocaleString(); } } Entry Component struct WordsLibrary { // 状态管理 State words: WordItem[] []; State inputWord: string ; State inputMeaning: string ; State searchText: string ; State currentView: string list; // list 或 add // 添加单词 addWord() { if (!this.inputWord.trim() || !this.inputMeaning.trim()) { promptAction.showToast({ message: 请输入完整的单词和释义 }); return; } const newWord new WordItem( Date.now(), this.inputWord.trim(), this.inputMeaning.trim() ); this.words [newWord, ...this.words]; this.inputWord ; this.inputMeaning ; promptAction.showToast({ message: 添加成功 }); this.currentView list; } // 删除单词 deleteWord(id: number) { this.words this.words.filter(item item.id ! id); promptAction.showToast({ message: 删除成功 }); } // 获取显示的单词列表支持搜索 getDisplayWords(): WordItem[] { if (!this.searchText.trim()) { return this.words; } const search this.searchText.toLowerCase().trim(); return this.words.filter(item item.word.toLowerCase().includes(search) || item.meaning.toLowerCase().includes(search) ); } // 获取统计信息 getStats(): string { return 共 ${this.words.length} 个单词; } build() { Column() { // 标题栏 Row({ space: 10 }) { Text(单词库) .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor(Color.Blue) Text(this.getStats()) .fontSize(14) .fontColor(Color.Gray) } .width(100%) .justifyContent(FlexAlign.Center) .padding(15) // 顶部按钮 Row({ space: 20 }) { Button(this.currentView list ? 单词列表 : 返回列表) .onClick(() { this.currentView list; }) .backgroundColor(this.currentView list ? Color.Blue : Color.Gray) Button(添加新单词) .onClick(() { this.currentView add; }) .backgroundColor(this.currentView add ? Color.Blue : Color.Gray) } .width(100%) .justifyContent(FlexAlign.Center) .padding(10) // 搜索栏仅在列表视图显示 if (this.currentView list) { Row() { TextInput({ placeholder: 搜索单词或释义... }) .width(80%) .height(40) .onChange((value: string) { this.searchText value; }) if (this.searchText) { Button(✕) .width(40) .height(40) .fontSize(12) .onClick(() { this.searchText ; }) } } .width(90%) .padding(10) .borderRadius(20) .backgroundColor(Color.White) .shadow({ radius: 2, color: Color.Gray, offsetX: 1, offsetY: 1 }) } // 主要内容区域 if (this.currentView list) { this.buildWordList(); } else { this.buildAddForm(); } } .width(100%) .height(100%) .backgroundColor(Color.LightGray) .padding(10) } // 构建单词列表 Builder buildWordList() { const displayWords this.getDisplayWords(); if (displayWords.length 0) { Column() { Image($r(app.media.icon)) .width(100) .height(100) .margin({ bottom: 20 }) Text(this.searchText ? 未找到相关单词 : 暂无单词点击添加新单词开始学习) .fontSize(16) .fontColor(Color.Gray) .textAlign(TextAlign.Center) } .width(100%) .height(60%) .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) return; } List({ space: 10 }) { ForEach(displayWords, (item: WordItem) { ListItem() { Column({ space: 5 }) { // 单词和释义 Row() { Text(item.word) .fontSize(18) .fontWeight(FontWeight.Bold) .fontColor(Color.Black) Text((${new Date(item.date).toLocaleDateString()})) .fontSize(12) .fontColor(Color.Gray) .margin({ left: 10 }) } .width(100%) .justifyContent(FlexAlign.Start) Text(item.meaning) .fontSize(16) .fontColor(Color.DarkGray) .width(100%) .textAlign(TextAlign.Start) // 操作按钮 Row({ space: 20 }) { Button(删除) .width(60) .height(30) .fontSize(12) .backgroundColor(Color.Red) .fontColor(Color.White) .onClick(() this.deleteWord(item.id)) } .width(100%) .justifyContent(FlexAlign.End) .margin({ top: 10 }) } .padding(15) .width(100%) .backgroundColor(Color.White) .borderRadius(10) .shadow({ radius: 2, color: Color.Gray, offsetX: 1, offsetY: 1 }) } }, (item: WordItem) item.id.toString()) } .width(100%) .height(75%) .margin({ top: 10 }) } // 构建添加表单 Builder buildAddForm() { Column({ space: 20 }) { // 单词输入 Column({ space: 5 }) { Text(单词) .fontSize(16) .fontColor(Color.Black) .width(90%) .textAlign(TextAlign.Start) TextInput({ placeholder: 输入英文单词 }) .width(90%) .height(50) .fontSize(18) .onChange((value: string) { this.inputWord value; }) .backgroundColor(Color.White) .borderRadius(10) .padding(10) } // 释义输入 Column({ space: 5 }) { Text(释义) .fontSize(16) .fontColor(Color.Black) .width(90%) .textAlign(TextAlign.Start) TextInput({ placeholder: 输入中文释义 }) .width(90%) .height(50) .fontSize(18) .onChange((value: string) { this.inputMeaning value; }) .backgroundColor(Color.White) .borderRadius(10) .padding(10) } // 添加按钮 Button(添加单词) .width(90%) .height(50) .fontSize(18) .backgroundColor(Color.Blue) .fontColor(Color.White) .onClick(() this.addWord()) .margin({ top: 30 }) // 示例单词 Column({ space: 10 }) { Text(示例) .fontSize(14) .fontColor(Color.Gray) Row({ space: 20 }) { Button(Apple) .onClick(() { this.inputWord Apple; this.inputMeaning 苹果; }) Button(Book) .onClick(() { this.inputWord Book; this.inputMeaning 书; }) Button(Computer) .onClick(() { this.inputWord Computer; this.inputMeaning 计算机; }) } } .margin({ top: 30 }) } .width(100%) .padding(20) .backgroundColor(Color.White) .borderRadius(15) .shadow({ radius: 5, color: Color.Gray, offsetX: 2, offsetY: 2 }) .margin({ top: 20 }) } }入门鸿蒙开发又怕花冤枉钱?别错过!现在能免费系统学 -- 从 ArkTS 面向对象核心的类和对象、继承多态到吃透鸿蒙开发关键技能还能冲刺鸿蒙基础 高级开发者证书更惊喜的是考证成功还送好礼!快加入我的鸿蒙班一起从入门到精通班级链接:点击https://developer.huawei.com/consumer/cn/training/classDetail/b7365031334e4353a9a0fd6785bb0791?type1?ha_sourcehmosclassha_sourceId89000248免费进入
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

网站维护要多久时间asp wordpress

5步实现企业级云服务自动化:ZeroBot-Plugin实战指南 【免费下载链接】ZeroBot-Plugin 基于 ZeroBot 的 OneBot 插件 项目地址: https://gitcode.com/GitHub_Trending/ze/ZeroBot-Plugin 在数字化转型浪潮中,企业云服务自动化已成为提升运维效率和…

张小明 2026/1/4 2:05:10 网站建设

宁波网站建设的价格表wordpress 安卓客户端

Teradata RDBMS架构与功能详解 1. 解析引擎 Teradata RDBMS是基于ASCII编码的系统。在处理数据前,解析引擎会将EBCDIC(以及其他非ASCII编码)的输入数据转换为ASCII编码。 1.1 SQL解析器 SQL解析器负责处理所有传入的SQL请求,其处理流程如下: | 阶段 | 处理过程 | | …

张小明 2026/1/3 2:55:19 网站建设

网站专题建设晋城网站制作公司怎么选

如何在10分钟内为你的语音应用添加智能身份识别功能? 【免费下载链接】wespeaker Research and Production Oriented Speaker Verification, Recognition and Diarization Toolkit 项目地址: https://gitcode.com/gh_mirrors/we/wespeaker Wespeaker是一个专…

张小明 2026/1/3 23:04:18 网站建设

长沙理财网站建设整站seo

一、前列腺癌诊疗面临哪些关键技术瓶颈?前列腺癌作为男性高发恶性肿瘤,其临床诊疗存在双重挑战:在诊断层面,基于前列腺特异性抗原(PSA)的血清检测存在较高假阳性率,难以实现精准定位&#xff1b…

张小明 2026/1/5 2:31:18 网站建设

网站备案在哪个网柳州搜索引擎营销平台

毕业论文季如何高效完成开题报告和论文是学生普遍面临的挑战,传统人工写作方式灵活但效率较低,而AI工具能快速生成内容、优化文本重复率并处理AI痕迹。通过对9款主流平台的对比测试,可以筛选出最适合学术场景的智能辅助工具,实测数…

张小明 2026/1/4 23:11:15 网站建设

宿迁高端网站建设无锡网站优化

想要彻底释放惠普OMEN游戏本的隐藏性能潜力吗?OmenSuperHub作为一款轻量级系统优化工具,专门为惠普OMEN系列游戏本设计,提供智能风扇控制、性能模式切换和实时硬件监控等强大功能,让你成为设备性能的真正掌控者。 【免费下载链接】…

张小明 2026/1/2 9:54:25 网站建设