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

朝阳网站建设 国展电脑网站制作

朝阳网站建设 国展,电脑网站制作,成品人和精品人的区别在哪约,购物网站建设 属于信息系统管理与设计么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/958305/

相关文章:

  • 网站设计模板简约东莞市建设安监监督网站首页
  • 网站seo思路网站服务器要求
  • 上海app定制网站内链如何做优化
  • 怎么建设微信网站网站html5自适应屏幕
  • 建站网络提高网站流量原则
  • ppt做视频模板下载网站有哪些门户网站模板源码
  • 南沙门户网站建设杭州建设网站官网
  • 网站建设好公司哪家好网站备案怎么做
  • 秦皇岛陵县网站建设上海企业网站
  • 怎么编写一个网站asp网站用什么软件
  • html5 手机端网站wordpress手机重定向
  • 郑州网站运营实力乐云seo国际域名注册流程
  • 网站名称 备案营销型企业网站有哪些平台
  • 食品贸易网站建设案例wordpress父文章显示不全
  • 正定城乡建设网站网站代码用什么打开
  • 网站的构成要素媒体资源网官网
  • 网站资料库建设的功能需求wordpress 获取当前分类id
  • vs2015网站开发基础样式wordpress调用随机文章代码
  • 美丽乡村建设规划文本网站企业网站推广的形式有哪些
  • 新闻静态网站模板下载购物网站开发语言
  • 如何做淘宝店网站网站开发商怎么关闭图片显示
  • 网站做icp备案有哪些好处安溪县住房和城乡规划建设局网站
  • 阜新网站设计成都代运营公司
  • 互联网网站建设挣钱吗行业门户网站大全
  • 网站 技术方案公众号小程序怎么做
  • 网站设计英文网站怎样做平面设计图
  • 网站备案要关多久一物一码二维码生成系统
  • 网站开发参考文献2015年后大数据网页制作教程
  • 邯郸做网站的电话wordpress add from server
  • 移动端网站开发流程图比较有名的公司网站