国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Dokumentation zur WeChat-Applet-Entwicklung / 微信小程序表單組件多行輸入框 textarea

微信小程序表單組件多行輸入框 textarea

微信小程序textarea

多行輸入框。

QQ截圖20170208103356.png

示例代碼:

<!--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="這是一個可以自動聚焦的textarea" auto-focus />
</view>
<view class="section">
  <textarea placeholder="這個只有在按鈕點擊的時候才聚焦" focus="{{focus}}" />
  <view class="btn-area">
    <button bindtap="bindButtonTap">使得輸入框獲取焦點</button>
  </view>
</view>
//textarea.js
Page({
  data: {
    height: 20,
    focus: false
  },
  bindButtonTap: function() {
    this.setData({
      focus: true
    })
  },
  bindTextAreaBlur: function(e) {
    console.log(e.detail.value)
  }
})

Bug & Tip

  1. bug: 微信版本 6.3.30,textarea 在列表渲染時,新增加的 textarea 在自動聚焦時的位置計算錯誤
  2. tip: 請勿在 scroll-view 中使用 textarea 組件