You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
921 B

<!--components/password-box.wxml-->
<view class="password-box">
<view class='password-wrapper'>
<!-- 伪装的input -->
<block wx:for="{{inputLength}}" wx:key="item">
<!-- 宽高可以由外部指定 -->
<view class="{{item===(inputLength-1)?'password-item-last':'password-item'}}" style="width: {{inputWidth}}; height: {{inputHeight}}" catchtap='_focusInput'>
<!-- 隐藏密码时显示的小圆点【自定义】 -->
<view wx:if="{{!showValue && currentValue.length>=index+1}}" class="hidden"></view>
<!-- 显示密码时显示对应的值 -->
<view wx:if="{{showValue}}" class="show">{{currentValue.length>=index+1?currentValue[index]:''}}</view>
</view>
</block>
</view>
<!-- 隐藏的输入框 -->
<input type="number" password="{{true}}" value="{{currentValue}}" class='hidden-input' maxlength="{{inputLength}}" focus="{{inputFocus}}" bindinput="_setCurrentValue"></input>
</view>