search
HomeWeChat AppletMini Program DevelopmentWeChat applet component: textarea multi-line input box interpretation and analysis

textarea multi-line input box component description:

textarea multi-line input box.

The textarea multi-line input box sample code runs as follows:

 微信小程序组件:textarea多行输入框解读和分析

The following is the WXML code:

<view>
placeholder:
<textarea></textarea>
<textarea></textarea>
<textarea></textarea>
</view>

The following is the WXSS code:

.content{
  border:1px black solid;
  margin: 10px;
  font-size: 10pt;
  padding: 10px;
}
textarea{
  border: 1px red solid;
  margin: auto;
  width:100%;
  height: 3em;
  margin-top:5px;
  padding: 3px;
}
/*占位符样式*/
.placeholdText{
  font-size: 2em;
}

Textarea multi-line input box event rendering:

 微信小程序组件:textarea多行输入框解读和分析

The following is the WXML code::

<view>
auto-height:
<textarea></textarea>
bindinput="当内容改变"
<textarea></textarea>
bindfocus:当获取焦点
<textarea></textarea>
bindblur:当失去焦点触发
<textarea></textarea>
</view>
事件触发:
<view>
{{log}}
</view>

The following is the JS code::

Page({
  data:{
    log:'事件触发'
  },
  //行高改变时
  bindlinechange:function(e){
    var height=e.detail.height;
    var heightRpx=e.detail.heightRpx;
    var lineCount=e.detail.lineCount;
    this.setData({
      log:"height="+height+"  |  heightRpx="+heightRpx+"  |  lineCount="+lineCount
    })
  },
    //文本失去焦点
  bindblur:function(e){
    var value=e.detail.value;
     this.setData({
      log:"bindblur失去改变.获取textarea值="+value
    })
  },
   //文本获取焦点
  bindfocus:function(e){
    var value=e.detail.value;
     this.setData({
      log:"bindfocus获取焦点,获取textarea值="+value
    })
  }
})

The following is the WXSS code: :

.content{
  border:1px black solid;
  margin: 10px;
  font-size: 10pt;
  padding: 10px;
}
textarea{
  border: 1px red solid;
  margin: auto;
  width:100%;
  height: 3em;
  margin-top:5px;
  padding: 3px;
}

 微信小程序组件:textarea多行输入框解读和分析

Attribute parsing:

The following is the WXML code:

<!--=======属性=======-->
<!--value:输入框内容-->
<textarea></textarea>
<!--placeholder:占位符,对输入框内容提示-->
<textarea></textarea>
<!--disabled:控制标签有效,或者失效状态,在失效状态,不能获取该值-->
<textarea></textarea>
<textarea></textarea> 等同于 <textarea></textarea>
<!--maxlength:内容长度限制,默认140-->
<textarea></textarea>
<textarea></textarea> 等同于 <textarea></textarea>
<!--focus:初始化时,获取输入焦点(目前开发工具暂不支持)-->
<textarea></textarea>
<textarea></textarea> 等同于 <textarea></textarea>
<!--auto-focus:当界面只有一个textarea,自动获取焦点-->
<textarea></textarea>
<textarea></textarea> 等同于 <textarea></textarea>
<!--auto-height:是否自动增高,设置auto-height时,style.height不生效-->
<textarea></textarea>
<textarea></textarea> 等同于 <textarea></textarea>
<!--=======事件=======-->
<!--bindlinechange:输入框行数变化时调用 返回参数:height,heightRpx,lineCount-->
<textarea></textarea>
<!--bindfocus:当获取焦点,可用输入状态时触发-->
<textarea></textarea>
<!--bindblur:当失去焦点触发-->

The above is the detailed content of WeChat applet component: textarea multi-line input box interpretation and analysis. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.