The content of this article is about the WeChat applet example: the code implementation of form submission, which has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
<view class='container'> <form bindsubmit='denglu'> <view class='list'> <view class='left'> <label>手机号:</label> <input type='number' name="tel" bindinput='shj' maxlength='11' placeholder='请输入手机号'></input> </view> <view class='right'></view> </view> <view class='list border'> <view class='left'> <label>验证码:</label> <input type='number' name="code" placeholder='请输入验证码'></input> </view> <view class='right'> <button class='send' wx:if="{{isShow}}" catchtap='send'>发送验证码</button> <button class='send' disabled='{{true}}' wx:else>{{countdown}}秒后重新发送</button> </view> </view> <button form-type='submit' class='btn'>登录</button> </form> </view>
const app = getApp() Page({ /** * 页面的初始数据 */ data: { isShow:true }, //登录 denglu:function(e){ let fromdate=e.detail.value; wx.request({ data:fromdate, success:function(res){} }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, })
Note: Form submission is key-value matching based on the name attribute of the input
Related recommendations:
App() function in WeChat applet Detailed usage explanation
WeChat applet example: How to get the user’s openid (with code)
The above is the detailed content of WeChat Mini Program Example: Code Implementation for Form Submission. For more information, please follow other related articles on the PHP Chinese website!