


WeChat 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:
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:
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; }
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

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 latest version

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.