소스 검색

bug 修复

lilei 4 년 전
부모
커밋
2d7d02ea05
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      pagesA/giftCard/giftCard.vue

+ 6 - 1
pagesA/giftCard/giftCard.vue

@@ -13,7 +13,7 @@
 				<image class="module-header-bg" src="/static/giftcard/module-header-bg.png"></image>
 				<view class="giftcard-main recharge-code">
 					<view class="inp-con">
-						<u-input v-model="rechargeCode" placeholder="请输入充值码" :maxlength="8" input-align="center" />
+						<u-input v-model="rechargeCode" @input="vailRcode" placeholder="请输入充值码(8位字母或数字)" :maxlength="8" input-align="center" />
 					</view>
 					<u-button class="recharge-btn" shape="circle" :custom-style="customBtnStyle" hover-class="none" @click="goRecharge">立即充值</u-button>
 				</view>
@@ -78,6 +78,11 @@
 			this.rechargeCode = ''
 		},
 		methods: {
+			// 校验卡号输入,只能输入字母和数字
+			vailRcode(event){
+				console.log(event)
+				this.rechargeCode = event.replace(/[^\w\.\/]/ig,'')
+			},
 			//  立即充值
 			goRecharge(){
 				if(!this.rechargeCode){