Home Web Front-end JS Tutorial How to implement WeChat applet using form to obtain input box data

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

May 29, 2018 am 10:06 AM
form use Applets

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!

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

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use magnet links How to use magnet links Feb 18, 2024 am 10:02 AM

How to use magnet links

How to use mdf and mds files How to use mdf and mds files Feb 19, 2024 pm 05:36 PM

How to use mdf and mds files

What software is crystaldiskmark? -How to use crystaldiskmark? What software is crystaldiskmark? -How to use crystaldiskmark? Mar 18, 2024 pm 02:58 PM

What software is crystaldiskmark? -How to use crystaldiskmark?

How to download foobar2000? -How to use foobar2000 How to download foobar2000? -How to use foobar2000 Mar 18, 2024 am 10:58 AM

How to download foobar2000? -How to use foobar2000

How to use NetEase Mailbox Master How to use NetEase Mailbox Master Mar 27, 2024 pm 05:32 PM

How to use NetEase Mailbox Master

How to use Baidu Netdisk app How to use Baidu Netdisk app Mar 27, 2024 pm 06:46 PM

How to use Baidu Netdisk app

How to use Xiaoai Speaker How to connect Xiaoai Speaker to mobile phone How to use Xiaoai Speaker How to connect Xiaoai Speaker to mobile phone Feb 22, 2024 pm 05:19 PM

How to use Xiaoai Speaker How to connect Xiaoai Speaker to mobile phone

Simple guide to pip mirror source: easily master how to use it Simple guide to pip mirror source: easily master how to use it Jan 16, 2024 am 10:18 AM

Simple guide to pip mirror source: easily master how to use it

See all articles