textarea多行輸入框元件說(shuō)明:
textarea 多行輸入框。
textarea多行輸入框範(fàn)例程式碼運(yùn)作效果如下: ? ?
#下面是WXML程式碼:
<view class="content"> placeholder: <textarea placeholder="占位符" /> <textarea placeholder="占位符 改變樣式style" placeholder-style= "color:blue"/> <textarea placeholder="占位符 改變樣式class" placeholder-class="placeholdText"/> </view>
下面是WXSS程式碼:
.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多行輸入框的事件效果圖:
#下面是WXML程式碼::
<view class="content"> auto-height: <textarea auto-height placeholder="自動(dòng)增高,style.height不生效"/> bindinput="當(dāng)內(nèi)容改變" <textarea placeholder="" bindlinechange="bindlinechange"/> bindfocus:當(dāng)獲取焦點(diǎn) <textarea placeholder="當(dāng)獲取焦點(diǎn)" value="" bindfocus="bindfocus"/> bindblur:當(dāng)失去焦點(diǎn)觸發(fā) <textarea placeholder="當(dāng)失去焦點(diǎn)" bindblur="bindblur"/> </view> 事件觸發(fā): <view class="content" style="color:blue"> {{log}} </view>
下面是JS程式碼::
Page({ ??data:{ ????log:'事件觸發(fā)' ??}, ??//行高改變時(shí) ??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 ????}) ??}, ????//文本失去焦點(diǎn) ??bindblur:function(e){ ????var?value=e.detail.value; ?????this.setData({ ??????log:"bindblur失去改變.獲取textarea值="+value ????}) ??}, ???//文本獲取焦點(diǎn) ??bindfocus:function(e){ ????var?value=e.detail.value; ?????this.setData({ ??????log:"bindfocus獲取焦點(diǎn),獲取textarea值="+value ????}) ??} })
以下是WXSS程式碼::
.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; }
#屬性解析:
下面是WXML程式碼:
<!--=======屬性=======--> <!--value:輸入框內(nèi)容--> <textarea value="內(nèi)容"/> <!--placeholder:占位符,對(duì)輸入框內(nèi)容提示--> <textarea placeholder="占位符" placeholder-class="占位符靜態(tài)樣式" placeholder-style="占位符動(dòng)態(tài)樣式"/> <!--disabled:控制標(biāo)簽有效,或者失效狀態(tài),在失效狀態(tài),不能獲取該值--> <textarea disabled="true"/> <textarea disabled/>?等同于?<textarea disabled="false"/> <!--maxlength:內(nèi)容長(zhǎng)度限制,默認(rèn)140--> <textarea maxlength="100"/> <textarea maxlength/>?等同于?<textarea maxlength="140"/> <!--focus:初始化時(shí),獲取輸入焦點(diǎn)(目前開(kāi)發(fā)工具暫不支持)--> <textarea focus="true"/> <textarea focus/>?等同于?<textarea focus="false"/> <!--auto-focus:當(dāng)界面只有一個(gè)textarea,自動(dòng)獲取焦點(diǎn)--> <textarea auto-focus="true"/> <textarea auto-focus/>?等同于?<textarea auto-focus="false"/> <!--auto-height:是否自動(dòng)增高,設(shè)置auto-height時(shí),style.height不生效--> <textarea auto-height="true"/> <textarea auto-height/>?等同于?<textarea auto-height="false"/> <!--=======事件=======--> <!--bindlinechange:輸入框行數(shù)變化時(shí)調(diào)用 返回參數(shù):height,heightRpx,lineCount--> <textarea bindlinechange="自己定義函數(shù)名"/> <!--bindfocus:當(dāng)獲取焦點(diǎn),可用輸入狀態(tài)時(shí)觸發(fā)--> <textarea bindfocus="自己定義函數(shù)名"/> <!--bindblur:當(dāng)失去焦點(diǎn)觸發(fā)-->
以上是微信小程式元件:textarea多行輸入框解讀與分析的詳細(xì)內(nèi)容。更多資訊請(qǐng)關(guān)注PHP中文網(wǎng)其他相關(guān)文章!
本網(wǎng)站聲明
本文內(nèi)容由網(wǎng)友自願(yuàn)投稿,版權(quán)歸原作者所有。本站不承擔(dān)相應(yīng)的法律責(zé)任。如發(fā)現(xiàn)涉嫌抄襲或侵權(quán)的內(nèi)容,請(qǐng)聯(lián)絡(luò)admin@php.cn

熱AI工具

Undress AI Tool
免費(fèi)脫衣圖片

Undresser.AI Undress
人工智慧驅(qū)動(dòng)的應(yīng)用程序,用於創(chuàng)建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費(fèi)的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門(mén)文章
Grass Wonder Build Guide |烏瑪媽媽漂亮的德比
3 週前
By Jack chen
<??>:在森林裡99夜 - 所有徽章以及如何解鎖
3 週前
By DDD
烏瑪?shù)姆劢z漂亮的德比橫幅日程(2025年7月)
4 週前
By Jack chen
今天的連接提示並回答753年7月3日
1 個(gè)月前
By Jack chen
Windows安全是空白或不顯示選項(xiàng)
4 週前
By 下次還敢

熱工具

記事本++7.3.1
好用且免費(fèi)的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強(qiáng)大的PHP整合開(kāi)發(fā)環(huán)境

Dreamweaver CS6
視覺(jué)化網(wǎng)頁(yè)開(kāi)發(fā)工具

SublimeText3 Mac版
神級(jí)程式碼編輯軟體(SublimeText3)