Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/core/wxs/math.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function min(a,b){
return Math.min(a,b);
}

module.exports = {
min:min
}
8 changes: 4 additions & 4 deletions src/textarea/index.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!-- input/input.wxml -->
<wxs src="../core/wxs/math.wxs" module="Math" />

<label class='form-item {{disabled? "disabled": ""}}'>
<view class='default-border {{border? "border": ""}} l-class'>
<view class='mask' wx:if="{{disabled}}"></view>
Expand All @@ -21,9 +22,8 @@
bindblur="handleInputBlur"
bindconfirm="handleInputConfirm"
/>
<view
class="indicator"
wx:if="{{indicator}}">{{value.length + '/' + maxlength}}</view>
<!-- 使用 Math.min 的原因:在安卓平台上,由于微信的 bug,value.length 会超过 maxlength,导致显示不准确 -->
<view class="indicator" wx:if="{{indicator}}">{{Math.min(value.length,maxlength) + '/' + maxlength}}</view>
</view>
</label>
<l-error-tip l-error-text-class="l-error-text l-error-text-class" errorText="{{errorText}}" wx:if="{{errorText}}"/>