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

微信小程序?qū)崿F(xiàn)登錄注冊功能

 更新時間:2020年12月29日 14:37:02   作者:保護(hù)我方豆豆  
這篇文章主要介紹了微信小程序?qū)崿F(xiàn)登錄注冊功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了微信小程序?qū)崿F(xiàn)登錄注冊的具體代碼,供大家參考,具體內(nèi)容如下

html:

<form bindsubmit="handleSubmit" wx:if="{{ onoff }}">
 用戶名: <input type="text" name='username'/>
 密碼: <input type="password" name='password'/>
 手機(jī)號: <input type="text" name='phone'/>
 <button form-type="submit"> 注冊 </button>
</form>

<form bindsubmit="handleLogin" wx:else>
 用戶名: <input type="text" name='username'/>
 密碼: <input type="password" name='password'/>
 <button form-type="submit"> 登錄 </button>
</form>

js:

// pages/login/login.js
Page({

 /**
 * 頁面的初始數(shù)據(jù)
 */
 data: {
 onoff: false
 },
 handleSubmit(e){
 const {value} = e.detail;
 // console.log(value)
 const that = this;
 wx.request({
 url: 'http://pddapi.h5sm.com/index/pdduser/getpddregister',
 method: 'post',
 data: value,
 success(res){
 if(res.data.status == 1){
  that.setData({
  onoff: false
  })
 }
 }
 })
 },

 handleLogin(e){
 const {username, password} = e.detail.value;

 const that = this;
 wx.request({
 url: 'http://pddapi.h5sm.com/index/pdduser/getpddlogin',
 method: 'post',
 data:{
 username, password
 },
 success(res){
  console.log(res)
 }
 })
 },
 /**
 * 生命周期函數(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 () {

 },

 /**
 * 用戶點(diǎn)擊右上角分享
 */
 onShareAppMessage: function () {

 }
})

效果圖:

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

相關(guān)文章

最新評論