Home > Web Front-end > JS Tutorial > body text

How to implement WeChat applet using form to obtain input box data

php中世界最好的语言
Release: 2018-05-29 10:06:01
Original
2209 people have browsed it

This time I will show you how to implement the WeChat applet using the form form to obtain the input box data, and how to implement the WeChat applet using the form form to obtain the input box data. What are the precautions?. The following is a practical case. Let’s take a look.

1. Effect display

2. Key code

index.wxml

用户名: 
密码: 
登录 重置 {{tip}}{{userName}}{{psw}}
Copy after login

index.js

Page({ 
 data:{ 
 // text:"这是一个页面" 
 tip:'', 
 userName:'', 
 psw:'' 
 }, 
 formBindsubmit:function(e){ 
 if(e.detail.value.userName.length==0||e.detail.value.psw.length==0){ 
 this.setData({ 
 tip:'提示:用户名和密码不能为空!', 
 userName:'', 
 psw:'' 
 }) 
 }else{ 
 this.setData({ 
 tip:'', 
 userName:'用户名:'+e.detail.value.userName, 
 psw:'密码:'+e.detail.value.psw 
 }) 
 } 
 }, 
 formReset:function(){ 
 this.setData({ 
 tip:'', 
 userName:'', 
 psw:'' 
 }) 
 } 
})
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How to modify create-react-app to support multiple pages

How to implement WeChat applet Custom multi-select event

The above is the detailed content of How to implement WeChat applet using form to obtain input box data. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!