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

微信小程序使用toast消息對話框提示用戶忘記輸入用戶名或密碼功能【附源碼下載】

 更新時(shí)間:2017年12月09日 10:08:39   作者:FutrueJet  
這篇文章主要介紹了微信小程序使用toast消息對話框提示用戶忘記輸入用戶名或密碼功能,結(jié)合實(shí)例形式詳細(xì)分析了toast組件實(shí)現(xiàn)消息提示功能的相關(guān)操作技巧,并附帶源碼供讀者下載參考,需要的朋友可以參考下

本文實(shí)例講述了微信小程序使用toast消息對話框提示用戶忘記輸入用戶名或密碼功能。分享給大家供大家參考,具體如下:

1、效果展示

2、關(guān)鍵代碼

① index.wxml

<form bindsubmit="formBindsubmit" bindreset="formReset">
 <view style="display:flex;">
  <label>用戶名:</label>
  <input name="userName" placeholder="請輸入用戶名!" />
 </view>
 <view style="display:flex;">
  <label>密碼:</label>
  <input name="psw" placeholder="請輸入密碼!" password="true" />
 </view>
 <view style="display:flex;margin-top:30px;">
  <button style="width:30%;" formType="submit" >登錄</button>
  <button style="width:30%" formType="reset" >重置</button>
 </view>
</form>
<view>{{userName}}</view>
<view>{{psw}}</view>
<toast duration="2000" hidden="{{toastHidden}}" bindchange="toastBindChange">用戶名或密碼不能為空!</toast> 

② index.js

Page({
 data:{
  // text:"這是一個(gè)頁面"
  toastHidden:true,
  userName:'',
  psw:''
 },
 formBindsubmit:function(e){
  if(e.detail.value.userName.length==0||e.detail.value.psw.length==0){
   this.setData({
    toastHidden:!this.data.toastHidden
   })
  }else{
   this.setData({
    tip:'',
    userName:'用戶名:'+e.detail.value.userName,
    psw:'密碼:'+e.detail.value.psw
   })
  }
 },
 formReset:function(){
  this.setData({
   userName:'',
   psw:''
  })
 },
 toastBindChange:function(){
  this.setData({
    toastHidden:!this.data.toastHidden
  })
 }
})

3、源代碼點(diǎn)擊此處本站下載。

希望本文所述對大家微信小程序開發(fā)有所幫助。

相關(guān)文章

最新評論