HarmonyOS【ArkUI组件--TextInput】

1.文本输入框基本用法

2. 使用文本输入框组件(如何实现输入数字改变图片大小)

在此博客的基础上继续编写:HarmonyOS【ArkUI组件--Text】-CSDN博客

 ①代码如下:

import font from '@ohos.font'
@Entry
@Component
struct Index {
  @State imageWidth:number= 30

  build() {
    Row() {
      Column() {

        Image($r('app.media.app_icon'))
          .width(this.imageWidth)
          .interpolation(ImageInterpolation.High)
        Text($r('app.string.width_label'))
          .fontSize(20)
          .fontWeight(FontWeight.Bold)
        TextInput({text:this.imageWidth.toFixed(0)})
          .width(150)
          .backgroundColor('#36D')
          .type(InputType.Number)
          .onChange(value => {
            this.imageWidth=parseInt(value)
          })
      }

      .width('100%')
    }
    .height('100%')
  }
}

②效果如下

 

关于博客有任何问题欢迎咨询 ,看见就回😊

相关推荐

  1. vue 通讯

    2024-06-17 07:00:03       57 阅读
  2. Hadoop YARN

    2024-06-17 07:00:03       52 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-06-17 07:00:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-06-17 07:00:03       100 阅读
  3. 在Django里面运行非项目文件

    2024-06-17 07:00:03       82 阅读
  4. Python语言-面向对象

    2024-06-17 07:00:03       91 阅读

热门阅读

  1. QSharedMemory使用详解

    2024-06-17 07:00:03       28 阅读
  2. Qt 实战(4)信号与槽 | 4.3、信号连接信号

    2024-06-17 07:00:03       29 阅读
  3. 跨域资源共享(CORS)问题与解决方案

    2024-06-17 07:00:03       28 阅读
  4. wxml与标准的html的异同?

    2024-06-17 07:00:03       30 阅读
  5. 3.1. 马氏链-马氏链的定义和示例

    2024-06-17 07:00:03       27 阅读
  6. Android基础-JNI

    2024-06-17 07:00:03       24 阅读
  7. 一个简单的UDP客户端和服务端的完整C++示例

    2024-06-17 07:00:03       37 阅读
  8. 学习vite的核心原理

    2024-06-17 07:00:03       27 阅读
  9. Flutter学习(一)

    2024-06-17 07:00:03       30 阅读
  10. 【websocket】怎么终止websocket断开重连

    2024-06-17 07:00:03       30 阅读
  11. 【Git】撤销远程仓库的提交(push)

    2024-06-17 07:00:03       38 阅读
  12. cbam+lstm代码预测

    2024-06-17 07:00:03       22 阅读
  13. vant的作用及其使用方法

    2024-06-17 07:00:03       33 阅读
  14. 大数据开发语言Scala入门

    2024-06-17 07:00:03       32 阅读
  15. MySQL入门学习-子查询.ANY

    2024-06-17 07:00:03       29 阅读