uniapp 自定义类微信支付键盘 (微信小程序)

效果图

代码:

javascript 复制代码
	<view class="popups popupsB">
						<view class="appreciatePrice">
							<view class="appreciatePriceTitle">
								赞赏金额
							</view>
							<view class="appreciatePriceInput flex ac">
								¥<input type="text" disabled class="appreciatePriceInputs" />
							</view>
							<view class="minAppreciatePrice">
								最低赞赏¥
							</view>
						</view>
						<view class="">
							<view class="keyboard flex ac jsb">
								<view class="keyboardLeft">
									<!-- 19数字 -->
									<view class="flex flexwrap">
										<view class="keyboardLeftNumber flex jc ac" v-for="(item,index) in keyboard"
											:key="index">
											{{item}}
										</view>
									</view>
									<!-- 0和点的按键 -->
									<view class="keyboardLeftZooDrop flex jsb ac">
										<view class="keyboardLeftZoo  flex jc ac">
											0
										</view>
										<view class="keyboardLeftDrop  flex jc ac">
											.
										</view>
									</view>
								</view>
								<!-- 右边确定和删除 -->
								<view class="keyboardRight">
									<view class="keyboardRightDel  flex jc ac">
										<u-icon name="close" color="#232323" size="20"></u-icon>
									</view>
									<view class="keyboardRightConfirm  flex jc ac">
										确定
									</view>
								</view>
							</view>
							<view class="liness">

							</view>
						</view>

					</view>

css

css 复制代码
.popups {
		height: 55vh;
		padding: 0rpx 30rpx 40rpx 30rpx;
		box-sizing: border-box;
	}

	.popupsB {
		padding: 0 !important;
		display: flex;
		flex-direction: column;
		justify-content: space-between;

		.appreciatePrice {
			padding: 30rpx;
			box-sizing: border-box;

			.appreciatePriceTitle {
				font-size: 24rpx;
				// padding-left: 10rpx;
				// box-sizing: border-box;
			}

			.appreciatePriceInput {
				padding: 30rpx 0rpx;
				box-sizing: border-box;
				border-bottom: 1rpx solid #f5f5f5;
				font-size: 50rpx;
				font-weight: bold;

				.appreciatePriceInputs {
					margin-left: 10rpx;
				}
			}

			.minAppreciatePrice {
				color: #999;
				margin-top: 20rpx;
				font-size: 24rpx;
			}
		}

	}

	.keyboard {
		padding: 20rpx;
		box-sizing: border-box;
		background: #f5f5f5;
		border-radius: 8rpx;

		.keyboardLeft {
			width: 480rpx;
			height: 380rpx;
			// background: red;

			.keyboardLeftNumber {
				width: 146.66rpx;
				height: 80rpx;
				background: #fff;
				font-size: 30rpx;
				font-weight: bold;
				border-radius: 8rpx;
				margin-right: 20rpx;
				margin-bottom: 20rpx;

			}

			.keyboardLeftNumber:nth-child(3n+3) {
				margin-right: 0 !important;
			}

			.keyboardLeftZooDrop {
				.keyboardLeftZoo {
					width: 313.33rpx;
					background: #fff;
					font-size: 30rpx;
					font-weight: bold;
					border-radius: 8rpx;
					height: 80rpx;
				}

				.keyboardLeftDrop {
					width: 146.66rpx;
					background: #fff;
					font-size: 30rpx;
					font-weight: bold;
					border-radius: 8rpx;
					height: 80rpx;
				}
			}

		}

		.keyboardRight {
			width: 150rpx;
			height: 380rpx;

			// background: blue;
			.keyboardRightDel {
				width: 146.66rpx;
				background: #fff;
				font-size: 30rpx;
				font-weight: bold;
				border-radius: 8rpx;
				height: 80rpx;
			}

			.keyboardRightConfirm {
				width: 146.66rpx;
				background: #fff;
				font-size: 30rpx;
				font-weight: bold;
				border-radius: 8rpx;
				height: 272rpx;
				background: #4ac163;
				margin-top: 20rpx;
				color: #fff;
			}

			.keyboardRightConfirmNo {
				opacity: 0.1;
			}
		}
	}

一些公共样式

css 复制代码
	.flex{
		display: flex;
	}
	.jc{
		justify-content: center;
	}
	.ac{
		align-items: center;
	}
	.w100h100{
		width: 100%;
		height: 100%;
	}
	.jsb{
		justify-content: space-between;
	}
	.flexwrap{
		flex-wrap: wrap;
	}
	.me-text-beyond-multi2{
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
	}
	.je{
		justify-content: flex-end;
	}
	.jsa{
		justify-content: space-around;
	}

js

css 复制代码
keyboard: [1, 2, 3, 4, 5, 6, 7, 8, 9],

并未做任何事件,如需请自行添加。

相关推荐
mini king2 小时前
微信小程序提示 miniprogram-recycle-view 引入失败
微信小程序·小程序
shenweihong3 小时前
微信小程序获取图片使用session(下篇)
微信小程序·小程序
柏萱科技3 小时前
快手短剧播放器uniapp如何引入与对接?
uni-app·短剧源码·快手短剧播放器
代码の搬运工11 小时前
uniapp H5 对接 声网,截图
uni-app·声网·声网截图·声网视频截图
—Qeyser14 小时前
UNI-APP弹窗
微信小程序·uniapp
Burt15 小时前
【unibest】可以去掉hbx模版了,base模板一统天下
前端·微信小程序·uni-app
总裁余(余登武)17 小时前
微信小程序——第三章开发框架
微信小程序·小程序·notepad++
Q_192849990619 小时前
基于Spring Boot微信小程序电影管理系统
spring boot·后端·微信小程序
cxr8281 天前
基于微信小程序的面部动作检测
微信小程序·小程序
W.Y.B.G1 天前
微信小程序滑动解锁、滑动验证
安全·微信小程序