微网站建设代运营如网站站长如何对付黑客

张小明 2026/3/2 21:49:59
微网站建设代运营,如网站站长如何对付黑客,中级经济师考试,网络营销策略优化Styles https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V2/arkts-style-0000001473856690-V2 如果每个组件的样式都需要单独设置#xff0c;在开发过程中会出现大量代码在进行重复样式设置#xff0c;虽然可以复制粘贴#xff0c;但为了代码简洁性和后续方…Styleshttps://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V2/arkts-style-0000001473856690-V2如果每个组件的样式都需要单独设置在开发过程中会出现大量代码在进行重复样式设置虽然可以复制粘贴但为了代码简洁性和后续方便维护我们推出了可以提炼公共样式进行复用的装饰器Styles。Styles装饰器可以将多条样式设置提炼成一个方法直接在组件声明的位置调用。通过Styles装饰器可以快速定义并复用自定义样式。用于快速定义并复用自定义样式局部定义// 全局 Styles function functionNameStyle() { .width(150) .height(100) .backgroundColor(Color.Red) } ​ Entry Component sturt Index { // 组件内 Styles functionNameStyle() { ... } ​ build() { Text(Text) .functionNameStyle() } }demoEntry Component struct Index { ​ Styles iptStyle() { .width(80%) .height(50) .backgroundColor(Color.White) .border({ width: 1, color: Color.Gray }) .margin({top:20,bottom: 20}) } ​ build() { Column() { TextInput({placeholder:请输入手机号}) .iptStyle() ​ TextInput({placeholder:请输入验证码}) .iptStyle() } } }案例// function 函数名() {} // Styles function 函数名Style() {} // Styles function iptStyle() { // .width(90%).height(50).backgroundColor(#fff) // .border({ // width:{bottom:2}, // color: #e5e5e5 // }) // .margin({top:20}) // .borderRadius(0) // } ​ Entry Component struct Index { ​ Styles iptStyle() { .width(90%).height(50).backgroundColor(#fff) .border({ width:{bottom:2}, color: #e5e5e5 }) .margin({top:20}) .borderRadius(0) } ​ build() { Column(){ TextInput({placeholder:请输入手机号}).iptStyle() TextInput({placeholder:请输入验证码}).iptStyle() } } }ExtendExtend用于扩展原生组件样式通过传参提供更灵活的样式复用仅支持全局支持传参传递状态自动同步也可以传递回调函数// 全局 原生组件 参数 // ↓ ↓ ↓ Extend(Text) function 属性名字(data: number) { .width(data) }demo1// Styles function iptStyle() { Extend(TextInput) function iptStyle(width:number80) { // .width(80%) .width(${width}%) .backgroundColor(#fff) .border({ width: 1, color: #ccc, style: BorderStyle.Solid }) .margin({top:20,bottom:20}) } ​ Entry Component struct Index { build() { Column() { Text(登录页) ​ TextInput({placeholder:请输入用户名}) .iptStyle() // .width(100%) 不推荐 后者覆盖前者 ​ Row() { TextInput({placeholder:验证码}) .iptStyle(40) Button(获取验证码) } ​ } } }demo2Extend(TextInput) function iptStyle(cb: (data:string) void,w:number80) { .width(${w}%) .height(50) .backgroundColor(Color.White) .border({ width: 1, color: Color.Gray }) .margin({top:20,bottom: 20}) .onChange(cb) } ​ Entry Component struct Index { State mobile:string State code:string ​ State w:number 40 build() { Column() { Text(手机号${this.mobile}) Text(验证码${this.code}) ​ TextInput({placeholder:请输入手机号}) .iptStyle((data:string) { this.mobile data }) ​ TextInput({placeholder:请输入验证码}) .iptStyle((data:string) { this.code data },40) ​ TextInput({placeholder:点击变成}) .iptStyle((data:string) { this.code data },this.w) .onClick(() { this.w90 }) .onBlur(() { this.w 40 }) } } }多态stateStyles()可以依据组件的内部状态的不同快速设置不同样式。normal正常态。pressed按压态。focused获焦态。 DevEco5 有bug24.6disabled不可用态。Entry Component struct Index { ​ State disabled:boolean false // true 禁用 false没有禁用 启用 ​ build() { Column() { Text(通过Text内置组件模拟实现Button效果).fontSize(20) ​ // TextInput({placeholder:hello}) // .stateStyles({ // input打开后默认第一个自动获取焦点 // focused: { // .backgroundColor(red) // } // }) // // TextInput({placeholder:hello}) // .stateStyles({ // 第二个得自己点 // focused: { // .backgroundColor(red) // } // }) ​ Text(删除) .width(100).height(50) .fontColor(#fff) // .backgroundColor(#000) .borderRadius(25) .textAlign(TextAlign.Center) .focusable(true) // 获取焦点切记页面不能有默认获取焦点组件否相互影响 // .enabled(false) // 是否激活状态 true-启动false禁用 应该灰色 这哥们比较矫情需要点击修改状态才可以禁用 类似于获取短信验证码 不是立马禁用而是操作后 .enabled(!this.disabled) .stateStyles({ normal: { .backgroundColor(red) }, pressed: { .backgroundColor(#000) }, // focused: { // .backgroundColor(blue) // }, disabled: { .backgroundColor(#ccc) } }) ​ ​ Text(当前状态${this.disabled}-${this.disabled?已禁用:正常}) // disabled为真代表禁用了 咱们点击按钮让他启用 Button(this.disabled?启用:禁用).onClick(() this.disabled !this.disabled) } .padding(30) } }获取短信Entry Component struct Index { // 准备 完成布局 包括禁用效果 等等之类的 // 1 声明响应式数据 // content获取验证码、time60 学习咱们用10、timer定时器 后期清楚、 disabled 是否禁用 // 并且视图使用 // 2 绑定点击事件 // 4 事件处理函数中 // - 4.1 过滤 手机号过滤、避免重复点击 // - 4.2 立马-1 并同步页面 // - 4.3 每隔1秒-1 并且判断 time1 》先清空定时器接着响应式数据还原最后终止代码执行 // - 4.4 发送服务器请求 让服务器发送短信验证码 ​ State content:string 获取验证码 State isEnabled:boolean true ​ private time:number 10 private timer:number 0 ​ build() { Text(this.content) .fontSize(40) .fontColor(this.isEnabled?Color.White:#ccc) // .fontColor(#ccc) .borderRadius(30) .padding(20) // 是否可交互 true-可以 没有禁用 false-不可以 也就禁用了 .enabled(this.isEnabled) .stateStyles({ normal: { .backgroundColor(Color.Black) }, disabled: { .backgroundColor(Color.Gray) }, }) .onClick(() { // - 4.1 过滤 手机号过滤、避免重复点击 if (!this.isEnabled) return // - 4.2 立马-1 并同步页面 this.isEnabled false this.time-- this.content 剩余${this.time}s // - 4.3 每隔1秒-1 并且判断 time1 》先清空定时器接着响应式数据还原最后终止代码执行 this.timer setInterval(() { // 返回number 第一次1 第二次2 唯一的 if (this.time1) { clearInterval(this.timer) this.content 获取验证码 this.isEnabled true this.time 10 this.timer 0 return } this.time-- this.content 剩余${this.time}s }, 1000) // - 4.4 发送服务器请求 让服务器发送短信验证码 console.log(请求接口) }) } }欢迎加入课程班级考取鸿蒙认证https://developer.huawei.com/consumer/cn/training/classDetail/d43582bb30b34f548c16c127cb3be104?type1?ha_sourcehmosclassha_sourceId89000248
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

请人做网站需要什么免费咨询矢量图

你是否经常在阅读外文资料时感到束手无策?面对图片中的文字信息无法复制粘贴?在不同设备间切换翻译软件导致体验割裂?pot-desktop作为一款开源的跨平台翻译工具,完美解决了这些痛点,让你的翻译体验更加流畅高效。 【免…

张小明 2026/1/22 7:09:13 网站建设

平罗门户网站建设崇明网站怎么做seo

在免疫学与炎症研究领域,IL-1β(白细胞介素-1β)作为关键的促炎因子,广泛参与多种疾病的病理过程,包括类风湿性关节炎、2型糖尿病、心血管疾病及癌症免疫治疗等。针对这一重要靶点,艾美捷科技携手InvivoCro…

张小明 2026/1/22 7:08:42 网站建设

更新网站内容有什么用网站工程专业是什么

文章目录01 Grand Challenge 上数据集的下载02 zenodo上数据集的下载(1)直接在网页上下载(2)使用zenodo_get(3)使用wget03 hugging face 上数据集的下载(1)直接在网页上下载&#xf…

张小明 2026/1/22 7:08:11 网站建设

企业网站推广效果指标分析扬州网络推广公司

BACnet4J:构建企业级楼宇自动化系统的Java技术方案 【免费下载链接】BACnet4J 项目地址: https://gitcode.com/gh_mirrors/bac/BACnet4J 在数字化楼宇管理需求日益增长的背景下,BACnet4J作为业界领先的纯Java BACnet协议实现,为开发者…

张小明 2026/3/2 20:02:04 网站建设

做流量网站挂广告还能挣钱吗制作美食

还在为复杂图表的手动绘制而烦恼?想要摆脱拖拽式绘图的低效模式?Draw.io Mermaid插件的出现,彻底改变了传统图表制作方式。通过文本驱动的智能转换技术,让代码生成专业图表变得前所未有的简单高效。 【免费下载链接】drawio_merma…

张小明 2026/3/2 16:37:28 网站建设

介绍学校网站怎么做网页期末作业代码模板

一、目录学习背景:为什么学视图与索引?知识点 1:SQL 视图 —— 从 “复杂查询” 到 “一键复用”知识点 2:SQL 索引 —— 让查询 “飞” 起来的优化工具我的优秀项目:多场景视图 索引的联动实践踩坑实录:从…

张小明 2026/1/22 7:06:39 网站建设