当前位置: 首页 > news >正文

江苏省建设资格注册中心网站南昌seo外包公司

江苏省建设资格注册中心网站,南昌seo外包公司,网站html地图导航代码,豪圣建设项目管理网站视频课程: 东西比较多, 这里主要分享一些代码和案例. 开关灯效果案例: 开灯 开关灯效果案例: 关灯 Column 和 Row 的基本用法 Entry Component struct Index {State message: string 张三;build() {// 一行内容Row() {// 一列内容Column() {// 文本内容Text(this.mess…

视频课程:
在这里插入图片描述

东西比较多, 这里主要分享一些代码和案例.

开关灯效果案例: 开灯
在这里插入图片描述

开关灯效果案例: 关灯
在这里插入图片描述

Column 和 Row 的基本用法

@Entry
@Component
struct Index {@State message: string = '张三';build() {// 一行内容Row() {// 一列内容Column() {// 文本内容Text(this.message).fontSize(50)// 字体大小.fontWeight(FontWeight.Bold) // 字体粗细}.width("100%")}.height('100%')}
}

一行两列的布局

@Entry
@Component
struct Index {@State message: string = '张三';build() {// 一行内容Row() {// 一列内容Column() {// 文本内容Text(this.message).fontSize(50)// 字体大小.fontWeight(FontWeight.Bold) // 字体粗细}.width("50%")// 一列内容Column() {// 文本内容Text(this.message).fontSize(50)// 字体大小.fontWeight(FontWeight.Bold) // 字体粗细}.width("50%")}.height('100%')}
}

开关灯效果案例的基本实现

@Entry
@Component
struct Index {@State isOn: boolean = falsebuild() {Column({space: 10}) {if (this.isOn) {Image("pages/images/img_light.png").width(300).height(300)} else {Image("pages/images/img_dark.png").width(300).height(300)}Row({space: 30}) {Button("开灯").onClick(() => this.isOn = true)Button("关灯").onClick(() => this.isOn = false)}}.width("100%").height("100%").justifyContent(FlexAlign.Center)}
}

图标按钮案例

@Entry
@Component
struct Index {@State isOn: boolean = falsebuild() {Column() {Button(){Image("pages/images/ic_delete.png").width(25).height(25)}.width(50).height(50).type(ButtonType.Circle).backgroundColor(Color.Red).onClick(()=>console.log("删除成功"))}.width("100%").height("100%").justifyContent(FlexAlign.Center)}
}

自定义组件案例

@Entry
@Component
struct Index {@State isOn: boolean = falsebuild() {Column({ space: 10 }) {if (this.isOn) {Image("pages/images/img_light.png").width(300).height(300).borderRadius(20)} else {Image("pages/images/img_dark.png").width(300).height(300).borderRadius(20)}Row({ space: 30 }) {GreenButton().onClick(() => this.isOn = true)RedButton().onClick(() => this.isOn = false)}}.width("100%").height("100%").justifyContent(FlexAlign.Center)}
}@Component
struct RedButton {build() {Button({ type: ButtonType.Circle }) {Image("pages/images/icon_switch.png").width(25).height(25)}.width(50).height(50).backgroundColor(Color.Red)}
}@Component
struct GreenButton {build() {Button({ type: ButtonType.Circle }) {Image("pages/images/icon_switch.png").width(25).height(25)}.width(50).height(50).backgroundColor(Color.Green)}
}

自定义组件参数案例

@Entry
@Component
struct Index {@State isOn: boolean = falsebuild() {Column({ space: 10 }) {if (this.isOn) {Image("pages/images/img_light.png").width(300).height(300).borderRadius(20)} else {Image("pages/images/img_dark.png").width(300).height(300).borderRadius(20)}Row({ space: 30 }) {SwitchButton({ color: Color.Green }).onClick(() => this.isOn = true)SwitchButton().onClick(() => this.isOn = false)}}.width("100%").height("100%").justifyContent(FlexAlign.Center)}
}@Component
struct SwitchButton {color: Color = Color.Redbuild() {Button({ type: ButtonType.Circle }) {Image("pages/images/icon_switch.png").width(25).height(25)}.width(50).height(50).backgroundColor(this.color)}
}

组件文件案例

index.ets

import { SwitchButton } from './SwitchButton'@Entry
@Component
struct Index {@State isOn: boolean = falsebuild() {Column({ space: 10 }) {if (this.isOn) {Image("pages/images/img_light.png").width(300).height(300).borderRadius(20)} else {Image("pages/images/img_dark.png").width(300).height(300).borderRadius(20)}Row({ space: 30 }) {SwitchButton({ color: Color.Green }).onClick(() => this.isOn = true)SwitchButton().onClick(() => this.isOn = false)}}.width("100%").height("100%").justifyContent(FlexAlign.Center)}
}

SwitchButton.ets

@Component
export struct SwitchButton {color: Color = Color.Redbuild() {Button({ type: ButtonType.Circle }) {Image("pages/images/icon_switch.png").width(25).height(25)}.width(50).height(50).backgroundColor(this.color)}
}
http://www.mnyf.cn/news/46228.html

相关文章:

  • wordpress 钱包引擎优化是什么工作
  • 网站备案更换主体百度怎么注册自己的店铺
  • 嘉兴有能做网站优化google chrome网页版
  • bluehost wordpress网站seo具体怎么做?
  • 佛山外贸网站建设价位seo免费优化公司推荐
  • html个人网站设计模板品牌网站建设
  • 做网站建设公司什么是软文
  • 住房住房和城乡建设部网站宁波优化系统
  • 点金推广优化公司seo流量排名软件
  • 网站域名证书查询软考十大最靠谱it培训机构
  • 北京专业网站建设公司竞价广告
  • 网站建设违约网络营销推广的特点
  • 网站开发代码 免责声明关键词优化话术
  • 做微信电影网站宣传网站有哪些
  • 上海网站注销广州seo优化排名公司
  • 广州疫情最新情况 最新消息家庭优化大师
  • 商标注册在哪个部门申请谷歌seo服务商
  • 无锡做网站哪家好广州关于进一步优化疫情防控措施
  • 免费网站怎么赚钱游戏推广接单平台
  • 高明网站设计公司app营销策略
  • 中国临朐门户网站怎样建网站平台
  • 网站备案负责人 更换爱站查询
  • 荔湾区做网站b2b免费外链发布
  • 汕头教育的网站建设品牌网站建设哪家好
  • 网站建立健全举报工作机制免费网络推广平台有哪些
  • 射阳县住房和城乡建设局网站推广产品的软文怎么写
  • app开发制作平台网站建设网络优化工程师招聘信息
  • 武冈网站建设哪家好百度官方网站首页
  • wordpress转换emlogseo指导
  • 关于做网站的百度广告竞价排名