微信小程序的form表单进行提交

wxml可以这样写:

<form bindsubmit="formSubmit">

    <input name="input" placeholder="please input here" />

    <button formType="submit">Submit</button>
    
</form>

 js这样写

Page({
  formSubmit: function (e) {
    console.log('form发生了submit事件,携带数据为:', e.detail.value)
  },
})
发布了514 篇原创文章 · 获赞 182 · 访问量 36万+

猜你喜欢

转载自blog.csdn.net/dmw412724/article/details/104716986