欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

微信小程序?qū)崿F(xiàn)獲取手機(jī)號(hào)60s倒計(jì)時(shí)

 更新時(shí)間:2022年07月07日 17:25:11   作者:asteriaV  
這篇文章主要為大家詳細(xì)介紹了微信小程序?qū)崿F(xiàn)獲取手機(jī)號(hào)60s倒計(jì)時(shí),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了微信小程序?qū)崿F(xiàn)獲取手機(jī)號(hào)60s倒計(jì)時(shí)的具體代碼,供大家參考,具體內(nèi)容如下

1.效果:點(diǎn)擊獲取》60s倒計(jì)時(shí)》重新獲取

2.wxml

<view class="cu-form-group" style="border-top: 1rpx solid #eee;">
? ? ? <view class="title">手機(jī)號(hào)</view>
? ? ? <input name='phone' placeholder="請(qǐng)輸入新手機(jī)號(hào)" ?value="{{phone}}" type="number" bindinput="inputBindPhone" ></input>
? ? </view> ?
?
<view class="cu-form-group" style="border-bottom: 1rpx solid #eee;">
? ? ? <view class="title">驗(yàn)證碼</view>
? ? ? <input name='code' placeholder="請(qǐng)輸入驗(yàn)證碼" value="{[code]}" type="number" bindinput="inputBindCode"></input>
? ? ? <button class="cu-btn shadow {{disabled ? '':'bg-blue'}}" style="width:180rpx;height:72rpx;" ? bindtap='sendRegistCode'>{{time}}</button>
</view>

3.js

Page({
?
? /**
? ?* 頁面的初始數(shù)據(jù)
? ?*/
? data: {
? ? disabled:false,
? ? time: '點(diǎn)擊獲取',
? ? currentTime: 60,
? ? phone: '',
? ? code: '',
? },
?
??
? // 新手機(jī)號(hào)
? inputBindPhone: function (e) {
? ? console.log(e.detail.value)
? ? this.setData({
? ? ? phone: e.detail.value
? ? })
? },
? // 驗(yàn)證碼
? inputBindCode: function (e) {
? ? console.log(e.detail.value)
? ? this.setData({
? ? ? code: e.detail.value
? ? })
? },
?
? sendRegistCode: function(e){
? ? var that = this;
? ? var currentTime = that.data.currentTime;
? ? ? var interval;
? ? ? that.setData({
? ? ? ? time: currentTime + 's',
? ? ? ? disabled: true,
? ? ? })
? ? ? interval = setInterval(function () {
? ? ? ? that.setData({
? ? ? ? ? time: (currentTime - 1) + ' s'
? ? ? ? })
? ? ? ? currentTime--;
? ? ? ? if (currentTime <= 0) {
? ? ? ? ? clearInterval(interval)
? ? ? ? ? that.setData({
? ? ? ? ? ? time: '重新獲取',
? ? ? ? ? ? currentTime: 60,
? ? ? ? ? ? disabled: false
? ? ? ? ? })
? ? ? ? }
? ? ? }, 1000)
},
?
?
? formSubmit: function (e) {
? ? var that = this,
? ? ? value = e.detail.value,
? ? ? formId = e.detail.formId;
? ? // value.phone = this.data.phone
? ? // value.code = this.data.code
?
?
? ? var mPattern = /^1[3-9]\d{9}$/; //手機(jī)號(hào)碼
? ? var authReg = /^\d{4}$/; //4位純數(shù)字驗(yàn)證碼
? ? var notempty = /^\\S+$/; //非空
?
? ? if (this.data.phone == '' || this.data.phone == undefined) {
? ? ? return wx.showToast({
? ? ? ? title: '請(qǐng)輸入手機(jī)號(hào)碼',
? ? ? ? icon: 'none'
? ? ? })
? ? } else if (!mPattern.test(this.data.phone)) {
? ? ? return wx.showToast({
? ? ? ? title: '請(qǐng)輸入正確的手機(jī)號(hào)碼',
? ? ? ? icon: 'none'
? ? ? })
?
? ? } else {
? ? ? value.phone = this.data.phone
? ? ? console.log('value.phone', value.phone)
? ? }
?
?
? ? if (value.code == '' || value.code == undefined) {
? ? ? return wx.showToast({
? ? ? ? icon: 'none',
? ? ? ? title: '請(qǐng)輸入驗(yàn)證碼',
? ? ? });
? ? } else if (!authReg.test(this.data.code)) {
? ? ? return wx.showToast({
? ? ? ? title: '請(qǐng)輸入正確的驗(yàn)證碼',
? ? ? ? icon: 'none'
? ? ? })
?
? ? } else {
? ? ? value.code = this.data.code
? ? ? console.log('value.code', value.code)
? ? }
?
?
? ? wx.showToast({
? ? ? title: '提交成功',
? ? ? icon: 'success',
? ? ? duration: 2000,
? ? ? success: function () {
? ? ? ? ?console.log(value)
? ? ? ? that.setData({
? ? ? ? ? code: '',
? ? ? ? ? phone: ''?
? ? ? ? })
? ? ? }
? ? })
?
? },
??
?
})

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • javascript動(dòng)態(tài)生成樹形菜單的方法

    javascript動(dòng)態(tài)生成樹形菜單的方法

    這篇文章主要介紹了javascript動(dòng)態(tài)生成樹形菜單的方法,涉及JavaScript針對(duì)頁面元素與屬性的動(dòng)態(tài)操作技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-11-11
  • JavaScript面試必備技巧之手寫一個(gè)Promise

    JavaScript面試必備技巧之手寫一個(gè)Promise

    很多同學(xué)在面試的時(shí)候都會(huì)被要求手寫一個(gè)Promise,那么今天我總結(jié)了一些手寫Promise的方法,可以跟著我的思路一起來實(shí)現(xiàn)一個(gè)Promise,讓我們的面試更有把握
    2023-02-02
  • 微信小程序?qū)悠吲T拼鎯?chǔ)的方法

    微信小程序?qū)悠吲T拼鎯?chǔ)的方法

    本篇文章主要介紹了小程序?qū)悠吲T拼鎯?chǔ)的方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-07-07
  • JavaScript實(shí)現(xiàn)篩選數(shù)組

    JavaScript實(shí)現(xiàn)篩選數(shù)組

    這篇文章主要為大家詳細(xì)介紹了JavaScript實(shí)現(xiàn)篩選數(shù)組,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-03-03
  • 基于JS實(shí)現(xiàn)父組件的請(qǐng)求服務(wù)過程解析

    基于JS實(shí)現(xiàn)父組件的請(qǐng)求服務(wù)過程解析

    這篇文章主要介紹了基于JS實(shí)現(xiàn)父組件的請(qǐng)求服務(wù)過程解析,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-10-10
  • 淺談JS for循環(huán)中使用break和continue的區(qū)別

    淺談JS for循環(huán)中使用break和continue的區(qū)別

    這篇文章主要介紹了淺談for循環(huán)中使用break和continue的區(qū)別,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-07-07
  • 微信小程序MUI側(cè)滑導(dǎo)航菜單示例(Popup彈出式,左側(cè)不動(dòng),右側(cè)滑動(dòng))

    微信小程序MUI側(cè)滑導(dǎo)航菜單示例(Popup彈出式,左側(cè)不動(dòng),右側(cè)滑動(dòng))

    這篇文章主要介紹了微信小程序MUI側(cè)滑導(dǎo)航菜單,結(jié)合實(shí)例形式分析了微信小程序Popup彈出式,左側(cè)不動(dòng),右側(cè)滑動(dòng)菜單相關(guān)實(shí)現(xiàn)技巧與注意事項(xiàng),需要的朋友可以參考下
    2019-01-01
  • Echarts地圖添加引導(dǎo)線效果(labelLine)

    Echarts地圖添加引導(dǎo)線效果(labelLine)

    這篇文章主要介紹了Echarts地圖添加引導(dǎo)線效果(labelLine),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-09-09
  • 詳解jQuery事件

    詳解jQuery事件

    本文主要介紹了jQuery事件的相關(guān)知識(shí)。具有一定的參考價(jià)值,下面跟著小編一起來看下吧
    2017-01-01
  • Lottie動(dòng)畫前端開發(fā)使用技巧

    Lottie動(dòng)畫前端開發(fā)使用技巧

    這篇文章主要為大家介紹了Lottie動(dòng)畫前端開發(fā)使用技巧,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-06-06

最新評(píng)論