原来的代码如下:
<view class="row2"> <view class="left2"> <label><span style="color: red;">*</span>基原:</label> </view> <view class="right2"> <picker mode="selector" bindchange="bindPickerChange1" value="{{listQuery.originalName}}" range="{{material.originalOptions}}"
disabled="{{material.originalName!=''}}"> <textarea placeholder="请输入基原" name="originalName" value="{{material.originalName}}" disabled/> </picker> </view> </view>
但是,textarea的输入框不生效,即下图中基原仍然可以输入
原因分析:是因为textarea标签使用省略的格式disabled时,不生效,此时我们使用不省略的格式,即disabled="{{true}}",
<view class="row2"> <view class="left2"> <label><span style="color: red;">*</span>基原:</label> </view> <view class="right2"> <picker mode="selector" bindchange="bindPickerChange1" value="{{listQuery.originalName}}" range="{{material.originalOptions}}"
disabled="{{material.originalName!=''}}"> <textarea placeholder="请输入基原" name="originalName" value="{{material.originalName}}" disabled="{{true}}"/> </picker> </view> </view>
注意:在微信小程序中,写disabled=“true”或disabled=“false”是错误的。