当前位置:网站首页>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 () {
},
})
边栏推荐
- Gbpnzd firm offer for 14 months, simulation for 19 months, test stable
- 请问通达信开户安全吗?
- Install spoole
- MySQL transaction explanation
- Is CICC wealth safe? How long does it take to open an account
- Sorting out the latest data mining competition scheme!
- Network security detection and prevention test questions (4)
- Record Baidu search optimization thinking analysis
- Tcp/ip test questions (III)
- Comparison rules of strings in JS
猜你喜欢

Vulnhub range the planes: mercury

Tiger DAO VC产品正式上线,Seektiger生态的有力补充

One night I worked as an XPath Terminator: XPath Helper Plus

揭秘GES超大规模图计算引擎HyG:图切分

SEO outsourcing reliable company, enterprise SEO outsourcing company which reliable?

Bloom filter

JVM | runtime data area (heap space)

Sorting out the latest data mining competition scheme!

ECS 7-day practical training camp (Advanced route) -- day04 -- build a portal using ECs and polardb
![Overview and trend analysis of China's foreign direct investment industry in 2020 [figure]](/img/b3/73e01601885eddcd05b68a20f83ca8.jpg)
Overview and trend analysis of China's foreign direct investment industry in 2020 [figure]
随机推荐
SEO outsourcing reliable company, enterprise SEO outsourcing company which reliable?
Ali visual AI training camp -day03- construction of electronic photo album (face and expression recognition)
Connecting PHP to MySQL instances in the lamp environment of alicloud's liunx system
Can GoogleSEO only do content without external chain? (e6zzseo)
Tcp/ip test questions (I)
Tcp/ip test questions (4)
Solidity get quarterly time
QQ机器人:群成员自我禁言管理【最新beta2版本】
Gbpnzd firm offer for 14 months, simulation for 19 months, test stable
【C语言练习——打印上三角及其变形(带空格版)】
广州华锐互动打造VR展厅全景在线虚拟展厅
Embark on a new journey and reach the world with wisdom
Vscode debugging PHP configuration Xdebug
Google cloud SSH enable root password login
Install spoole
Vulnhub range - darkhole 1
LeetCode-78-子集
JVM | runtime data area (heap space)
New features of php7
Alicloud centos8.0 installing mysql8