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

Harmony Next开发通过bindSheet绑定半模态窗口

示例概述

Harmony Next开发通过bindSheet绑定半模态窗口

知识点

  1. 半模态窗口
  2. 父子组件传值

组件

LoginComponent

@Component
struct LoginComponent {// @Prop 父子单项绑定值@Prop message:string = ''// @Link 父子双向绑定值@Link userName:string@Link password:string@Link isShow: booleanbuild() {Column({ space: 10 }){Row(){Text(this.message).fontSize('25')}.margin({top: 50})Row(){TextInput({placeholder:'请输入用户名'}).onChange((value)=>{this.userName = value})}.width('90%')Row(){TextInput({ placeholder: '请输入密码' }).onChange((value)=>{this.password = value})}.width('90%')Row(){Button('登陆').onClick(()=>{this.isShow = false})}}.height('100%').width('100%')}
}

ModelTest

@Entry
@Component
struct ModelTest {@State message: string = '用户登录'@State isShow: boolean = false@State userName: string = ''@State password: string = ''@BuilderLoginComponentBuilder() {Column() {LoginComponent({message: this.message,userName: this.userName,password: this.password,isShow: this.isShow})}}build() {Column({ space: 10 }) {Row() {Text('用户名')Text(this.userName)}Row() {Text('密码')Text(this.password)}Button('打开半模态窗口').onClick(() => {this.isShow = true})Button('更新数据').onClick(() => {this.message = '用户登录更新'})}.height('100%').width('100%').bindSheet(this.isShow, this.LoginComponentBuilder, {height: 300,enableOutsideInteractive: true,})}
}

截图

在这里插入图片描述

http://www.lryc.cn/news/504070.html

相关文章:

  • YOLOv11改进,YOLOv11添加DLKA-Attention可变形大核注意力,WACV2024 ,二次创新C3k2结构
  • 【51单片机】矩阵按键快速上手
  • 一文说清:git reset HEAD原理
  • 【前端面试题】书、定位问题、困难
  • WADesk 升级 Webpack5 一些技术细节认识5和4的区别在哪里
  • 学习 Dockerfile 常用指令
  • day11 性能测试(3)——Jmeter 断言+关联
  • ES6中的map和set
  • UE5中实现Billboard公告板渲染
  • 泊松编辑 possion editing图像合成笔记
  • #渗透测试#漏洞挖掘#红蓝攻防#SRC漏洞挖掘
  • 系列2:基于Centos-8.6Kubernetes 集成GPU资源信息
  • Coturn 实战指南:WebRTC 中的 NAT 穿透利器
  • 基于卷积神经网络的Caser算法
  • 自闭症在学校:了解自闭症的特点,优化学校教育方式
  • 多线程的知识总结(8):用 thread 类 或全局 async (...) 函数,创建新线程时,谁才是在新线程里第一个被执行的函数
  • ArcGIS地理空间平台manager存在任意文件读取漏洞
  • HarmonyOS Next 元服务新建到上架全流程
  • 【Linux】makefile项目管理
  • Lumos学习王佩丰Excel第二十一讲:经典Excel动态图表实现原理
  • Linux框架(二)——pinctrl和gpio子系统
  • C++ string的基本概念
  • MAC虚拟机上安装WDA环境
  • 与 Cursor AI 对话编程:2小时开发报修维修微信小程序
  • leetcode-73.矩阵置零-day5
  • CSS学习记录13
  • CAD图纸加密软件哪个最好用 | 安全可靠的解决方案
  • 基于SSM+Vue的宠物医院管理系统
  • 处理VUE框架中,ElementUI控件u-table空值排序问题
  • 专业140+总分400+北京理工大学826信号处理导论考研经验北理工电子信息与通信工程,真题,大纲,参考书。