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

黄石企业网站设计html简单网页代码图片

黄石企业网站设计,html简单网页代码图片,免费空间网,内蒙古网络自学网站建设arkts是声名式UI DevEcoStudio的右侧预览器可以预览。有个TT的图标可以看布局的大小。和html的布局浏览很像。 上图布局对应的代码: Entry //入口 Component struct Index {State message: string Hello Harmonyos //State 数据改变了也刷新的标签build() {Row()…

arkts是声名式UI

DevEcoStudio的右侧预览器可以预览。有个TT的图标可以看布局的大小。和html的布局浏览很像。

上图布局对应的代码:


@Entry //入口
@Component
struct Index {@State message: string = 'Hello Harmonyos' //@State 数据改变了也刷新的标签build() {Row() {Column() {Text(this.message).fontSize(30).margin(10).padding(20).backgroundColor("#333333").fontColor(Color.White).border({width:3,color:Color.Blue}).borderRadius(10).onClick(() => {console.log("点击了text")this.message = "text"}).fontWeight(FontWeight.Bold)Divider().margin(10)Button("click").width(100).height(50).onClick(this.read.bind(this))}.width('100%').height('50%')}.height('100%').width('90%')}// 方法多的话写到这里read() {console.log("我是button的点击事件")this.message = "button"}
}

新建页面的时候选择page。就会主动把该页面添加在路由中。

此处就是新建的页面的路由。和微信小程序是一样一样的。要加到这个page上。

1、自定义组件内,自定义构件函数。

@Builder 注释来实现

@Entry //入口
@Component
struct PageB {@State message: string = 'Hello World' //@State 数据改变了也刷新的标签build() {Row() {Column() {this.TextLabel("账号")this.TextLabel("密码")Divider().margin(10)Button("click").width(100).height(50).onClick(this.read.bind(this))}.width('100%').height('50%')}.height('100%').width('90%')}// 方法多的话写到这里read() {console.log("我是button的点击事件")this.message = "button"}@Builder//自定义组件内,自定义构件函数TextLabel(title:string ){Text(title+this.message).fontSize(16).margin(10).padding(10).width(200).height(50).backgroundColor("#333333").fontColor(Color.White).border({width:3,color:Color.Blue}).borderRadius(10).onClick(() => {this.message ="admin"}).fontWeight(FontWeight.Bold)}
}

2.全局自定义构建函数

@Entry //入口
@Component
struct PageB {@State message: string = 'Hello World' //@State 数据改变了也刷新的标签build() {Row() {Column() {TextLabel("账号")TextLabel("密码")Divider().margin(10)Button("click").width(100).height(50).onClick(this.read.bind(this))}.width('100%').height('50%')}.height('100%').width('90%')}// 方法多的话写到这里read() {console.log("我是button的点击事件")this.message = "button"}
}
@Builder//全局自定义构件函数
function TextLabel(title:string ){Text(title+this.message).fontSize(16).margin(10).padding(10).width(200).height(50).backgroundColor("#333333").fontColor(Color.White).border({width:3,color:Color.Blue}).borderRadius(10).onClick(() => {this.message ="admin"//在全局不建议去修改message}).fontWeight(FontWeight.Bold)
}

3、全局自定义函数实现简单的登录功能。采用引用传值,函数回调的方法。

@Entry //入口
@Component
struct PageB_build_param {@State message: string = 'Hello World' //@State 数据改变了也刷新的标签@State username: string = ''@State password: string = ''build() {Row() {Column() {text({ title: "用户", valueStr:this.username, cb: (value:string) => {this.username=value} })text({ title:"密码",valueStr:this.password,cb:(value:string)=>{this.password=value} })Divider().margin(10)Row() {Button("登录").fontSize(16).width(100).height(50).margin({ right: 10, left: 10 }).onClick(this.login.bind(this))Button("重置").fontSize(16).width(100).height(50).margin({ left: 10, right: 10 }).onClick(this.reset.bind(this))}}.width('100%').height('50%')}.height('100%').width('100%')}//登录login() {console.log(this.username+"----"+this.password)}reset() {this.username = ""this.password = ""}
}@Builder //全局自定义构件函数
function text($$: { title: string,valueStr: string,cb: (value: string) => void }) {Row() {Text($$.title).fontSize(16).margin(10).padding(10).width(80).textAlign(TextAlign.Center).height(50).backgroundColor("#333333").fontColor(Color.White).border({width: 3,color: Color.Blue}).borderRadius(10).fontWeight(FontWeight.Bold)TextInput({ text: $$.valueStr }).width(200).height(50).fontSize(16).onChange((value: string) => {$$.cb(value)})}.alignItems(VerticalAlign.Center)}

http://www.yayakq.cn/news/844656/

相关文章:

  • 莆田有建设网站的公司码大连市城市建设管理局网站
  • 温州网站优化关键词淄博网站建设有实力
  • 国内 设计网站的公司网站建设定制网站建设公司
  • 做微信公众号的是哪个网站大连企业网站建设公司
  • 微信小视频网站开发怎样做吧网站排名做上去
  • 网站建设大作业网站建设知名
  • 服务类网站建设服务公司描述对于营销型网站建设很重要飘红效果更佳
  • 中小企业服务网百度搜索优化平台
  • 做视频点播网站品牌建设专项规划
  • 网站出现乱码typecho用Wordpress插件
  • 做网站怎么接活寻网站开发人员合作
  • 乐清网站建设哪个网站能在家做兼职
  • 先进的网站建设建一个个人网站
  • 小兔自助建站个体营业执照网上申请
  • 校园网站素材软件开发的自学教程
  • 杭州门户网站建设公司wordpress 后台 324
  • 卖网站模板设计网站公司地址
  • 中国建设银行官方网站app下载西安防疫今天最新消息
  • 做网站什么程序网站建设发朋友圈的图片
  • 教你做网站WordPress仿w3c主题
  • visual studio做网站现代家装设计公司
  • 金寨县建设局网站青白江做网站的公司
  • 北京建设信息港网站天水市网站建设
  • 温州建站程序wordpress怎么搬站
  • 广州陈村网站建设网站的页面布局是什么样的
  • 重庆营销网站wordpress怎么发文章
  • 南京网络建站公司网站建设后期服务收费标准
  • 重庆网站建设建站收费有哪些网站交互效果做的好的
  • 网站建设公司怎么推广长治在网络做推广
  • 做网站推广需要具备哪些条件WordPress支持外链图片