這篇文章主要講解了“小程序表單多行輸入框表格怎么實(shí)現(xiàn)”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“小程序表單多行輸入框表格怎么實(shí)現(xiàn)”吧!

成都創(chuàng)新互聯(lián)主要為客戶提供服務(wù)項(xiàng)目涵蓋了網(wǎng)頁視覺設(shè)計(jì)、VI標(biāo)志設(shè)計(jì)、成都全網(wǎng)營銷、網(wǎng)站程序開發(fā)、HTML5響應(yīng)式網(wǎng)站建設(shè)、成都做手機(jī)網(wǎng)站、微商城、網(wǎng)站托管及成都網(wǎng)站維護(hù)、WEB系統(tǒng)開發(fā)、域名注冊、國內(nèi)外服務(wù)器租用、視頻、平面設(shè)計(jì)、SEO優(yōu)化排名。設(shè)計(jì)、前端、后端三個(gè)建站步驟的完善服務(wù)體系。一人跟蹤測試的建站服務(wù)標(biāo)準(zhǔn)。已經(jīng)為成都航空箱行業(yè)客戶提供了網(wǎng)站開發(fā)服務(wù)。
多行輸入框。
| 屬性名 | 類型 | 默認(rèn)值 | 說明 |
|---|---|---|---|
| value | String | 輸入框的內(nèi)容 | |
| placeholder | String | 輸入框?yàn)榭諘r(shí)占位符 | |
| placeholder-style | String | 指定 placeholder 的樣式 | |
| placeholder-class | String | textarea-placeholder | 指定 placeholder 的樣式類 |
| disabled | Boolean | false | 是否禁用 |
| maxlength | Number | 140 | 最大輸入長度,設(shè)置為 -1 的時(shí)候不限制最大長度 |
| auto-focus | Boolean | false | 自動聚焦,拉起鍵盤。 |
| focus | Boolean | false | 獲取焦點(diǎn) |
| auto-height | Boolean | false | 是否自動增高,設(shè)置auto-height時(shí),style.height不生效 |
| fixed | Boolean | false | 如果 textarea 是在一個(gè)position:fixed的區(qū)域,需要顯示指定屬性 fixed 為 true |
| cursor-spacing | Number | 0 | 指定光標(biāo)與鍵盤的距離,單位 px 。取 textarea 距離底部的距離和 cursor-spacing 指定的距離的最小值作為光標(biāo)與鍵盤的距離 |
| bindfocus | EventHandle | 輸入框聚焦時(shí)觸發(fā),event.detail = {value: value} | |
| bindblur | EventHandle | 輸入框失去焦點(diǎn)時(shí)觸發(fā),event.detail = {value: value} | |
| bindlinechange | EventHandle | 輸入框行數(shù)變化時(shí)調(diào)用,event.detail = {height: 0, heightRpx: 0, lineCount: 0} | |
| bindinput | EventHandle | 當(dāng)鍵盤輸入時(shí),觸發(fā) input 事件,event.detail = {value: value},bindinput 處理函數(shù)的返回值并不會反映到 textarea 上 | |
| bindconfirm | EventHandle | 點(diǎn)擊完成時(shí), 觸發(fā) confirm 事件,event.detail = {value: value} |
示例代碼:
<!--textarea.wxml-->
<view class="section">
<textarea bindblur="bindTextAreaBlur" auto-height placeholder="自動變高" />
</view>
<view class="section">
<textarea placeholder="placeholder顏色是紅色的" placeholder-style="color:red;" />
</view>
<view class="section">
<textarea placeholder="這是一個(gè)可以自動聚焦的textarea" auto-focus />
</view>
<view class="section">
<textarea placeholder="這個(gè)只有在按鈕點(diǎn)擊的時(shí)候才聚焦" focus="{{focus}}" />
<view class="btn-area">
<button bindtap="bindButtonTap">使得輸入框獲取焦點(diǎn)</button>
</view>
</view><view class="section"> <form bindsubmit="bindFormSubmit"> <textarea placeholder="form 中的 textarea" name="textarea"/> <button form-type="submit"> 提交 </button> </form></view>//textarea.js
Page({
data: {
height: 20,
focus: false
},
bindButtonTap: function() {
this.setData({
focus: true
})
},
bindTextAreaBlur: function(e) {
console.log(e.detail.value)
}, bindFormSubmit: function(e) { console.log(e.detail.value.textarea) }
})Bug & Tip
bug: 微信版本6.3.30,textarea在列表渲染時(shí),新增加的textarea在自動聚焦時(shí)的位置計(jì)算錯(cuò)誤。
tip:textarea 的blur事件會晚于頁面上的tap事件,如果需要在button的點(diǎn)擊事件獲取textarea,可以使用form的bindsubmit。
tip: 不建議在多行文本上對用戶的輸入進(jìn)行修改,所以textarea的bindinput處理函數(shù)并不會將返回值反映到textarea上。
tip:textarea組件是由客戶端創(chuàng)建的原生組件,它的層級是最高的。
tip: 請勿在scroll-view中使用textarea組件。
tip:css動畫對textarea組件無效。
感謝各位的閱讀,以上就是“小程序表單多行輸入框表格怎么實(shí)現(xiàn)”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對小程序表單多行輸入框表格怎么實(shí)現(xiàn)這一問題有了更深刻的體會,具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識點(diǎn)的文章,歡迎關(guān)注!
網(wǎng)頁標(biāo)題:小程序表單多行輸入框表格怎么實(shí)現(xiàn)
標(biāo)題路徑:http://www.chinadenli.net/article22/gpohcc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、企業(yè)網(wǎng)站制作、電子商務(wù)、關(guān)鍵詞優(yōu)化、Google、網(wǎng)站設(shè)計(jì)公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)