当前位置:网站首页>Applet password input box
Applet password input box
2022-06-25 19:33:00 【Bin daotianxia】
Applet password input box .
The initial state is input Can't click .

Click on input Eject keyboard later . After all the input boxes are entered, you can click Submit .

Specific code :
<view class="Toptitle"> Please set the payment password and keep it properly </view>
<form bindsubmit="formSubmit">
<view class='content'>
<block wx:for="{
{Length}}" wx:key="item">
<input class='iptbox' value="{
{Value.length>=index+1?Value[index]:''}}" disabled password='{
{ispassword}}' catchtap='Tap'></input>
</block>
</view>
<input name="password" password="{
{true}}" class='ipt' maxlength="{
{Length}}" focus="{
{isFocus}}" bindinput="Focus"></input>
<view>
<button class="btn-area" type='primary' disabled='{
{disabled}}' formType="primary"> next step </button>
</view>
</form>CSS It's very simple :
.Toptitle{
text-align: center;
margin: 60rpx auto 46rpx;
font-size: 26rpx;
}
.content{
width: 660rpx;
padding:0 45rpx;
display: flex;
justify-content: space-around;
align-items: center;
margin-top: 100rpx;
}
.iptbox{
width: 110rpx;
height: 96rpx;
border:1rpx solid #ddd;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
.ipt{
width: 0;
height: 0;
}
.btn-area{
width: 80%;
margin-top: 60rpx;
}The key is JS. Focus popup IME , After losing focus, go to the next .
Page({
data: {
Length: 6, // Number of input fields
isFocus: true, // focusing
Value: "", // Input content
ispassword: true, // Whether the ciphertext is displayed true For the cipher , false In plain text .
disabled:true,
},
Focus(e) {
var that = this;
console.log(e.detail.value);
var inputValue = e.detail.value;
var ilen = inputValue.length;
if(ilen == 6){
that.setData({
disabled: false,
})
}else{
that.setData({
disabled: true,
})
}
that.setData({
Value: inputValue,
})
},
Tap() {
var that = this;
that.setData({
isFocus: true,
})
},
formSubmit(e) {
console.log(e.detail.value.password);
},
onLoad: function (options) {
},
onShow: function () {
},
})
边栏推荐
- Laravel validation rule followed Role of auth:: id()
- On location and scale in CNN
- Oriental Wealth function (the most complete edition of Childe Yong)
- Web development solution to cross domain problems
- New features of php7
- LNMP compilation and installation
- SQL is used for field data types in various databases
- System optimization method
- 为什么生命科学企业都在陆续上云?
- 网络安全检测与防范 测试题(一)
猜你喜欢

LNMP compilation and installation
![Overview and trend analysis of China's CT examination equipment industry in 2021 [figure]](/img/e0/d4ed9a9d91534be0d956414f6abaaa.jpg)
Overview and trend analysis of China's CT examination equipment industry in 2021 [figure]

什么是算子?

Connecting PHP to MySQL instances in the lamp environment of alicloud's liunx system

Uncover ges super large scale graph computing engine hyg: Graph Segmentation

JVM | runtime data area (heap space)

Vulnhub range the planes: mercury

JVM|运行时数据区(堆空间)

QQ机器人疫情查询/疫情关注等【最新beta2版本】

LeetCode-101-对称二叉树
随机推荐
PHP database connection version1.1
JS get data
Web development solution to cross domain problems
User management and permissions
Does GoogleSEO need to change the friend chain? (e6zzseo)
Convert word to PDF through libreoffice
Oriental Wealth function (the most complete edition of Childe Yong)
ECS 7-day practical training camp (Advanced route) -- day01 -- setting up FTP service based on ECS
LeetCode-78-子集
ECS 7-day practical training camp (Advanced route) -- day04 -- build a portal using ECs and polardb
Tcp/ip test questions (II)
Embark on a new journey and reach the world with wisdom
Android Development Notes - Quick Start (from sqllite to room licentiousness) 2
Yum command
Dependency injection in PHP reflection implementation framework
什么是算子?
二、HikariCP获取连接流程源码分析二
Vulnhub range the planes: mercury
Idea common plug-ins
Guangzhou Sinovel interactive VR panorama brings development to all walks of life