想请问一下我这种情况点击登录按钮为什么控制台里面没有显示呢?
页面wxml代码:
<form bindsubmit="taos">
<view class="v3">
<input name="username" placeholder="请输入用户名" class="v-input" value="{{ username }}" />
</view>
<view class="v3" style="margin-top:5rpx;">
<input name="password" placeholder="请输入密码" password="true" class="v-input" value="{{ password }}" />
</view>
<view class="v4">
<button type="primary" class="v4-btn"><text class="v4-btn-txt" form-type="submit">登录</text></button>
</view>
<view class="v4" style="margin-top:5rpx;">
<button class="v4-btn" style="background-color:#ddd"><text class="v4-btn-txt">注册</text></button>
</view>
</form>
页面js代码:
Page({
data: {
username:"admin",
password:"123"
},
taos:function(e){
console.log(e)
}
})
<form catchsubmit="formSubmit" catchreset="formReset"> <view class="page-section page-section-gap"> <view class="page-section-title">switch</view> <switch name="switch"/> </view> <view class="page-section page-section-gap"> <view class="page-section-title">radio</view> <radio-group name="radio"> <label><radio value="radio1"/>选项一</label> <label><radio value="radio2"/>选项二</label> </radio-group> </view> <view class="page-section page-section-gap"> <view class="page-section-title">checkbox</view> <checkbox-group name="checkbox"> <label><checkbox value="checkbox1"/>选项一</label> <label><checkbox value="checkbox2"/>选项二</label> </checkbox-group> </view> <view class="page-section page-section-gap"> <view class="page-section-title">slider</view> <slider value="50" name="slider" show-value ></slider> </view> <view class="page-section"> <view class="page-section-title">input</view> <view class="weui-cells weui-cells_after-title"> <view class="weui-cell weui-cell_input"> <view class="weui-cell__bd" style="margin: 30rpx 0" > <input class="weui-input" name="input" placeholder="这是一个输入框" /> </view> </view> </view> </view> <view class="btn-area"> <button style="margin: 30rpx 0" type="primary" formType="submit">Submit</button> <button style="margin: 30rpx 0" formType="reset">Reset</button> </view> </form> formSubmit(e) { console.log('form发生了submit事件,携带数据为:', e.detail.value) },
不能在行间绑定值。
是键盘的事情 当键盘弹起 会导致form无法提交 需要连续点击键盘的完成文字 才有可能恢复