Mini program development-input tag example tutorial

零下一度
Release: 2017-05-24 09:15:33
Original
2274 people have browsed it

This article mainly introduces relevant information about the detailed explanation and simple examples of input tags in WeChat Mini Programs. Friends in need can refer to

Detailed explanation and simple examples of input tags in WeChat Mini Programs

We all know how to use input tags. We can definitely use it in WeChat mini programs. However, there are some commonly used attributes that cannot be used according to habit:
I will use my favorite Commonly used examples:

Interpret one by one:

首先,我是定义了他的id,这是我们最常用的,所以就配了一个id,毕竟不操作他,又为什么设成输入框呢, 
第二,设置他的样式, 
第三,设置他的输入类别,以上都是很简单的 
第四。使用正则l;哎限定输入为纯数字。这点可能有点不理解,这是对他的keyup事件监听,将不是纯数字的list无视掉。注意,是对整个,不是经行筛选。 
第五,限制他的输入最多6位数 
第六输入事件监听。这是微信专属的,他的事件下面会给出 
第七,设置当输入框为空的时候他的‘提示语';
Copy after login

bindinput event:

bind, as the name suggests, is binding. The input input

event is as follows:

 tapevent:function(e){
  // 减少的时候
  if (e.target.id =="increase"){
this.data.tickets++;
this.setData(this.data);
  }
  else {
   this.data.tickets--;
   this.setData(this.data);
  }
  // 在这里修改总额
 },
Copy after login

This is an excerpt, so don’t be curious about how to run to this section, you can see it. tapevent is defined as a function. And when operating here, I feel that WeChat is almost the same as Android. All by refreshing the page.

【Related recommendations】

1. Complete source code download of WeChat mini program

2. WeChat mini program demo: Kaka Auto

3. Simple left swipe operation and waterfall flow layout

The above is the detailed content of Mini program development-input tag example tutorial. 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!