uinapp获取表单内容
- 通过v-model获取表单的内容
- 通过form获取表单的内容
v-model方法:
<template> <view> <input v-model="phoneData" placeholder="GULAO"> <button @click="GULAO">执行</button> </view> </template> <script> export default { data() { return { phoneData:"" } }, methods: { GULAO(){ console.log(this.phoneData) if(this.phoneData.length < 5){ uni.showToast({ icon: 'none', position: 'bottom', title: 'GR' }); } } } } </script> <style> </style>
form获取表单内容:
<template> <view> <form @submit="formSubmit" @reset="formReset"> <input name="id" type="text" :value="id"/> <button form-type="submit">更新</button> </form> </view> </template> <script> export default { data() { return { id : "" } }, methods: { formSubmit: function(e) { console.log(e.detail.value.id) var ber = e.detail.value.id if(ber.length < 5){ uni.showToast({ icon: 'none', position: 'bottom', title: 'GR' }); } } } } </script> <style> </style>
Warning: Undefined variable $aria_req in /www/wwwroot/l.lvovl.cn/wp-content/themes/JieStyle-Two-master/comments.php on line 26
Warning: Undefined variable $aria_req in /www/wwwroot/l.lvovl.cn/wp-content/themes/JieStyle-Two-master/comments.php on line 27
Warning: Undefined variable $aria_req in /www/wwwroot/l.lvovl.cn/wp-content/themes/JieStyle-Two-master/comments.php on line 28