新版微信开发者工具的bug-from
发布于 5 年前 作者 gxiao 9085 次浏览 来自 问答

操作系统版本:window7 64

微信开发者工具版本:2017.09.07(1.01.170907)


问题:

组件from的input输入框没有数据或者没有操作时

点击button提交

不触发

【注:在手机上测试没有问题】

第一次不触发

第二次点击手机号码聚焦或者输入,也没有触发

第三次触发验证码聚焦或者输入,这个时候input都有数据或者有过操作的时候,才能触发

2 回复

暂时没有复现此问题,是否可以贴出 wxml 和 js 的相关示例代码呢

wxml:

<!–会员注册–>

<import src="/pages/template/navigation.wxml"/>

<template is=“navigation” data="{{system:systemInfo.system,title: ‘’,images:‘http://o2m.oss-cn-qingdao.aliyuncs.com/wechat-mall/mini/images/common/register.png’}}"/>

<view class=“register-container”>

<form bindsubmit=“formSubmit”>

<label class=“register-item”>

<view class=“item-title”>手机号码:</view>

<input name=“mobile” value="{{data.mobile}}" bindblur=“onMobile” type=“number” focus=“true” placeholder=“请输入手机号码” maxlength=“11” style=“width:250rpx;”/>

</label>

<label class=“register-item”>

<view class=“item-title”>验证码:</view>

<input name=“captcha” type=“number” focus=“false” placeholder=“请输入验证码” maxlength=“6” style=“width:250rpx;”/>

<view hidden="{{!count.hidden}}" class=“captcha-button” data-mobile="{{data.mobile}}" bindtap=“onCaptcha”>{{‘发送验证码’}}</view>

<view hidden="{{count.hidden}}" class=“captcha-button”>{{count.num}}秒之后再发</view>

</label>

<label class=“register-item”>

<view class=“item-title”>昵称:</view>

<input name=“nickname” value="{{data.nickname}}" type=“text” focus=“false” placeholder=“请输入昵称” style=“width:250rpx;”/>

</label>

<label class=“register-item”>

<view class=“item-title”>性别:</view>

<radio-group class=“radio-group”  name=“sex”>

<label class=“radio”>

<radio value=“0” checked="{{data.sex==0}}"/>

<radio value=“1” checked="{{data.sex==1}}"/>

</label>

</radio-group>

</label>

<view class=“register-item”>

<picker name=“birthday” mode=“date” vaule="{{data.birthday}}" bindchange=“bindDateChange”>

<label class=“register-item”>

<view class=“item-title”>生日:</view>

<text>{{data.birthday}}</text>

</label>

</picker>

</view>

<view class=“register-button”>

<button form-type=‘submit’>注册</button>

</view>

</form>  

</view>

js:

// register.js

let app = getApp()

let _config = require(’…/…/utils/config.js’);

let _http = require(’…/…/utils/httpUtil.js’);

Page({

/**

  * 页面的初始数据

  */

data: {

systemInfo: {}, //设备系统信息

data:{

mobile: “”,//手机号码

nickname: “”,//会员昵称

sex: 0,//性别,0:女,1:男

birthday: “点击选择”,//生日

captcha: “”//验证码

},

count:{

num:60,

hidden:true

}//倒计时

},

/**

  * 生命周期函数–监听页面加载

  */

onLoad: function (options) {

app.onSystemInfo()

},

/**

  * 生命周期函数–监听页面初次渲染完成

  */

onReady: function () {

let _this = this;

let _data = _this.data.data

app.getUserInfo(function (userInfo) {

_data.nickname = userInfo.nickName

_data.sex = userInfo.gender

_this.setData({

data: _data

})

})

},

/**

  * 生命周期函数–监听页面显示

  */

onShow: function () {

},

/**

  * 生命周期函数–监听页面隐藏

  */

onHide: function () {

},

/**

  * 生命周期函数–监听页面卸载

  */

onUnload: function () {

},

/**

  * 用户点击右上角分享

  */

onShareAppMessage: function () {

},

/**

  * @生日

  * **/

bindDateChange:function(e){

let _this = this

let _data = _this.data.data

_data.birthday = e.detail.value

_this.setData({

data: _data

})

},

/**

  * @表单提交

  * **/

formSubmit:function(e){

console.log(e)

let _this = this

let _data = _this.data.data

let url = _config.config.register

let params = e.detail.value

// params = JSON.stringify(params)

console.log(params)

_http.http.post(url, params, function (response) {

if (response.status==0){

wx.showToast({

title: ‘注册成功~’,

success:function(){

wx.reLaunch({

url: ‘/pages/index/index’,

})

}

})

} else if (response.status == 1){

wx.showToast({ title: ‘:验证码无效~’ })

} else if (response.status == 2){

wx.showToast({ title: ‘该手机号码已注册啦~’ })

}else{

wx.showToast({title: ‘注册失败~’})

}

})

},

/**

  * @发送验证码

  * **/

onCaptcha:function(e){

let _this = this

let _data = _this.data.data

let _count = _this.data.count

let url = _config.config.captcha

let _mobile = _data.mobile

if (_mobile == null || _mobile == ‘’) {

wx.showToast({ title: ‘手机号码不能为空哟~’ })

return

}

if (!(/^1[34578]\d{9}$/.test(_mobile))) {

wx.showToast({ title: ‘手机号码格式不对哟~’ })

return

}

let params = {

mobile: _mobile

}

_http.http.post(url, params, function (response) {

if (response.status == 0) {

wx.showToast({

title: ‘发送成功~’,

icon: ‘success’,

success: function () {

let _time = setInterval(function(){

if (_count.num <= 0) {

_count.hidden = true

_count.num = 60

clearInterval(_time)

} else {

_count.hidden = false

_count.num

}

_this.setData({

count: _count

})

},1000)

}

})

} else {

wx.showToast({

title: ‘发送失败~’,

success: function () {

}

})

}

})

},

/**

  * @手机号码

  * **/

onMobile:function(e){

let _this = this

let _data = _this.data.data

let _value = e.detail.value

_data.mobile = _value

if (_value == null || _value == ‘’) {

wx.showToast({ title: ‘手机号码不能为空哟~’ })

return

}

if (!(/^1[34578]\d{9}$/.test(_value))) {

wx.showToast({ title: ‘手机号码格式不对哟~’ })

return

}

_this.setData({

data: _data

})

},

/**

  * @数据校验

  * @param validtype

  * **/

onValidate:function(e){

// let _this = this

// let _type = e.currentTarget.dataset.validtype

// let _title = e.currentTarget.dataset.title

// let _value = e.detail.value

// if (_value == null || _value==’’){

//   wx.showToast({ title: _title+‘不能为空~’})

//   return

// }

// switch (_type) {

//   case “mobile”:

//     break;

//   case “isNull”:

//     break;

//   case “number”:

//     break;

//   default:

// }

}

})

回到顶部