html
<input
class="popupInputsIpt"
v-model="redeemCode"
placeholder="请输入活动方发放给您的优惠码"
maxlength="8"
/>
js
<script>
export default {
name: "user-discount-coupon",
data() {
return {
redeemCode: "", //优惠券码
showClass:false,
};
},
watch:{
redeemCode:{
handler(newVal){
//newVal为实时输入的值
this.showClass = newVal.length === 8 ? true : false
}
}
}
}
</script>