html实现密码输入框效果

<div class="pay-pop-count">
					<p>请输入支付密码</p>
					<div class="input-box">
						<input class="code-input" ref="pwd" v-model="code" :maxlength="length" type="number" id="code" @keyup.13="next()" />
						<label for="code">
							<ul class="code-box centerboth">
								<li class="code-number centerboth" v-for="(item, index) in length" :class="code.length==index?'cur':''" :key="index">
									<i v-if="code.length > index"></i>
									<b class="line"></b>
								</li>
							</ul>
						</label>
					</div>
				</div>
data: {
	length: 6,
	code: '',
},
methods: {
	focusBtn:function() {
		this.showPop = true;
		this.$nextTick(function() {
			this.$refs.pwd.focus();
		})
	},
	next: function() {
		return this.code;
	}
}
/* 验证密码验证码弹窗 */
.pay-pop{
	position: fixed;
	width: 100%;
	left: 0;
	top: 0;
	height: 100%;
	background: rgba(0,0,0,0.65);
	z-index: 90;
}
.pop-pg-close{
	width: 100%;
	height: 100%;
}
.pay-pop .pay-pop-count{
	position: absolute;
	width: 100%;
	background: #FFFFFF;
	padding: 0.5rem 0 1.2rem 0;
	left: 0;
	bottom: 0;
	z-index: 9;
}
.pay-pop-count>p{
	text-align: center;
	font-size: 0.28rem;
	color: #999999;
}
.pay-pop-count .input-box{
	width: 100%;
}
.pay-pop-count #code{
	width: 100%;
	height: 0.82rem;
	position: absolute;
	z-index: -1;
}
.pay-pop-count .code-box{
	width: 100%;
	padding: 0.25rem;
}
.pay-pop-count .code-box li{
	width: 0.8rem;
	height: 0.8rem;
	border: 1px solid #969696;
	margin: 0 0.1rem;
	text-align: center;
	line-height: 0.8rem;
	font-size: 0.3rem;
}
.pay-pop-count .code-box li.cur{
	border: 1px solid red;
}
.code-number i{
	width: 0.1rem;
	height: 0.1rem;
	border-radius: 50%;
	overflow: hidden;
	background: #333333;
}
.code-number b{
	height: 50%;
	width: 1px;
	background: red;
	opacity: 0;
}
.code-number.cur b{
	opacity: 1;
	-webkit-animation: sharkLight 1s linear infinite;
	animation: sharkLight 1s linear infinite;
}


@-webkit-keyframes sharkLight {
	from {
		-webkit-transform: scale(1);
		opacity: 1;
	}
	to {
		-webkit-transform: scale(0.9);
		opacity: 0;
	}
}

猜你喜欢

转载自blog.csdn.net/qq_35086913/article/details/108937963