当前位置:网站首页>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 () {
},
})
边栏推荐
- What should I pay attention to in GoogleSEO content station optimization?
- SEO outsourcing reliable company, enterprise SEO outsourcing company which reliable?
- Why are life science enterprises on the cloud in succession?
- ECS 7-day practical training camp (Advanced route) -- day04 -- build a portal using ECs and polardb
- Vulnhub range - darkhole 1
- Tcp/ip test questions (II)
- Read multiple associations from a field using delimiters in laravel
- LNMP compilation and installation
- Go language installation and uninstallation
- 想知道新股民怎样炒股票开户?在线开户安全么?
猜你喜欢
最新数据挖掘赛事方案梳理!
Ali visual AI training camp -day05- creativity day - your image recognition project
什么是算子?
QQ robot epidemic situation query / epidemic situation concern [latest beta2 version]
最新數據挖掘賽事方案梳理!
云上弹性高性能计算,支持生命科学产业高速发展、降本增效
What should I pay attention to in GoogleSEO content station optimization?
Sorting out the latest data mining competition scheme!
广州华锐互动打造VR展厅全景在线虚拟展厅
Analysis on planting area, output and import of sugarcane in Guangxi in 2021: the output of sugarcane in Guangxi accounts for 68.56% of the total output of sugarcane in China [figure]
随机推荐
Install spoole
Huawei released two promotion plans to promote AI talent development and scientific research innovation
wooyun-2014-065513
广州华锐互动打造VR展厅全景在线虚拟展厅
ActiveMQ--CVE-2016-3088
rmi-registry-bind-deserialization
Combing the latest Data Mining Event Scheme!
In 2021, China's private equity market is growing, and the scale of private equity fund management reaches 19.78 trillion yuan [figure]
Principles of MySQL clustered index and non clustered index
Many varieties of EA can be used
Yum command
Ali visual AI training camp -day03- construction of electronic photo album (face and expression recognition)
One night I worked as an XPath Terminator: XPath Helper Plus
System optimization method
网络安全检测与防范 测试题(一)
MySQL view explanation
Vulnhub range - correlation:2
Dependency injection in PHP reflection implementation framework
二、HikariCP獲取連接流程源碼分析二
Analysis on market scale and supply of China's needle coke industry in 2020 [figure]