最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

微信小程序?qū)崿F(xiàn)手機號碼驗證

 更新時間:2022年07月01日 10:50:14   作者:云城雪華  
這篇文章主要為大家詳細(xì)介紹了微信小程序?qū)崿F(xiàn)手機號碼驗證,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了微信小程序?qū)崿F(xiàn)手機號碼驗證的具體代碼,供大家參考,具體內(nèi)容如下

wxml

<form bindsubmit='formSubmit'>
? <view class='all'>
? ? <text>手機號:</text>
? ? <input name="phone" placeholder='請輸入手機號' type='number' style='color:#333' placeholder-style="color:#666" maxlength="11" bindinput='blurPhone'></input>
? </view>
? <button formType="submit">保存</button>
</form>

wxss

.all {
? border-top: 1rpx solid #efefef;
? border-bottom: 1rpx solid #efefef;
? height: 98rpx;
? font-size: 28rpx;
? display: flex;
? align-items: center;
}
?
button {
? width: 480rpx;
? height: 80rpx;
? background-color: #7ecffd;
? font-size: 30rpx;
? color: #fff;
? border-radius: 8px;
? margin: 50rpx auto;
}

js

Page({
?
? /**
? ?* 頁面的初始數(shù)據(jù)
? ?*/
? data: {
? ? ajxtrue: false,
? },
? // 手機號驗證
? blurPhone: function(e) {
? ? var phone = e.detail.value;
? ? let that = this
? ? if (!(/^1[34578]\d{9}$/.test(phone))) {
?
? ? ? this.setData({
? ? ? ? ajxtrue: false
? ? ? })
? ? ? if (phone.length >= 11) {
? ? ? ? wx.showToast({
? ? ? ? ? title: '手機號有誤',
? ? ? ? ? icon: 'success',
? ? ? ? ? duration: 2000
? ? ? ? })
? ? ? }
? ? } else {
? ? ? this.setData({
? ? ? ? ajxtrue: true
? ? ? })
? ? ? console.log('驗證成功', that.data.ajxtrue)
? ? }
? },
? // 表單提交
? formSubmit(e) {
? ? let that = this
? ? let val = e.detail.value
? ? let ajxtrue = this.data.ajxtrue
? ? if (ajxtrue == true) {
? ? ? //表單提交進行
? ? } else {
? ? ? wx.showToast({
? ? ? ? title: '手機號有誤',
? ? ? ? icon: 'success',
? ? ? ? duration: 2000
? ? ? })
? ? }
? },
? /**
? ?* 生命周期函數(shù)--監(jiān)聽頁面加載
? ?*/
? onLoad: function(options) {
?
? },
?
? /**
? ?* 生命周期函數(shù)--監(jiān)聽頁面初次渲染完成
? ?*/
? onReady: function() {
?
? },
?
? /**
? ?* 生命周期函數(shù)--監(jiān)聽頁面顯示
? ?*/
? onShow: function() {
?
? },
?
? /**
? ?* 生命周期函數(shù)--監(jiān)聽頁面隱藏
? ?*/
? onHide: function() {
?
? },
?
? /**
? ?* 生命周期函數(shù)--監(jiān)聽頁面卸載
? ?*/
? onUnload: function() {
?
? },
?
? /**
? ?* 頁面相關(guān)事件處理函數(shù)--監(jiān)聽用戶下拉動作
? ?*/
? onPullDownRefresh: function() {
?
? },
?
? /**
? ?* 頁面上拉觸底事件的處理函數(shù)
? ?*/
? onReachBottom: function() {
?
? },
?
? /**
? ?* 用戶點擊右上角分享
? ?*/
? onShareAppMessage: function() {
?
? }
})

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

相關(guān)文章

最新評論

漾濞| 文水县| 合阳县| 青海省| 寻乌县| 保靖县| 江达县| 遵义市| 蕲春县| 拉孜县| 沅江市| 雷山县| 黄大仙区| 泽州县| 印江| 鸡泽县| 丘北县| 中牟县| 甘洛县| 江山市| 石泉县| 咸丰县| 塘沽区| 美姑县| 杭锦旗| 西林县| 芜湖县| 科技| 沙洋县| 耿马| 马关县| 神池县| 金溪县| 锡林郭勒盟| 喜德县| 唐海县| 靖宇县| 招远市| 资源县| 宁都县| 沾化县|