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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

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.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.