uniapp vue 实现模仿微信支付密码弹窗

需求模仿支付模态框

<template>
	<view class="modalBg">
		<view class="modal_view">
			<view>
				请输入密码!
			</view>
			<view class="password">
				<view class="flex">
					<view class="password_num flex" v-for="(item,index) in miney_list">
						<view class="flex" v-if="item.id == index">
							<view v-for="(res,i) in money_input.length" v-show="i == index">
								<view class="miney_data"></view>
							</view>
						</view>
					</view>
				</view>
				<input v-model="money_input" maxlength="6" type="number" value="123" @input="input_num">
			</view>
		</view>
	</view>
</template>

<script>
	export default {
	
		data() {
			return {
				miney_list: [
					{id: 0,name: ''},
					{id: 1,name: ''},
					{id: 2,name: ''},
					{id: 3,name: ''},
					{id: 4,name: ''},
					{id: 5,name: ''},
				],
				money_input: '',
			};
		},
		created() {
			
		},
		methods: {
			// --------------------------------------------- input框事件
			input_num() {
				const that = this
				console.log(that.money_input.length)
				that.miney_list.forEach((item, index) => {
					for (var i = 0; i < that.money_input.length; i++) {
						if (i == index) {
							that.miney_list[index].name = '*'
						}
					}
				})
			}
		}
	}
</script>

<style scoped>
	.modalBg {
		width: 100vw;
		height: 100vh;
		position: absolute;
		top: 0;
		background-color: rgba(0, 0, 0, 0.4);
		z-index: 9999;
		display: flex;
		align-items: center;
		justify-content: center;
		overflow: hidden;
	}

	.modal_view {
		width: 70%;
		margin: 0 auto;
		background-color: #FFFFFF;
		padding: 22rpx 3%;
		box-sizing: border-box;
		border-radius: 20rpx;
		/* position: fixed;
	bottom: 0; */
	}
.flex{
	display: flex;
	align-items: center;
}
	.password {
		width: 100%;
		height: 66rpx;
		position: relative;
		margin: 22rpx 0;
	}

	.password_num {
		flex: 1;
		height: 65rpx;
		line-height: 65rpx;
		text-align: center;
		border: 2rpx solid #F2F2F2;
		justify-content: center;
	}

	.miney_data {
		width: 20rpx;
		height: 20rpx;
		background-color: #000000;
		border-radius: 50%;
	}

	.password input {
		width: 100%;
		height: 100%;
		position: absolute;
		top: 0;
		left: 0;
		opacity: 0;
	}
</style>

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值