模板
<view class="item-box">
<text class='black-font input-name'>郵箱</text>
<input type="text" placeholder="請(qǐng)輸入員工郵箱">
<view class='send-code' wx:if="{{timeIsShow}}">{{codeTime}}s</view>
<view class='send-code'wx:else @tap='sendCode'>獲取驗(yàn)證碼</view>
</view>
js
data={
codeTime:60,
timeIsShow:false
};
timeInteval() {
var that = this;
var n = this.codeTime;
var time=setInterval(function(){
if(n>0){
n=n-1;
that.codeTime=n;
}else{
n = 60;
clearInterval(time);
that.timeIsShow=false;
that.codeTime=n;
}
that.$apply();
},1000);
}山孔,
sendCode(){
this.timeIsShow=true;
this.timeInteval();
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者