Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use input tags in WeChat Mini Programs

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

Today, I will share with you the relevant knowledge points on how to use input tags in Weixin Mini Programs (Mini). The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so I will share this article for your reference. I hope you will gain something after reading this article. Let's learn about it together.

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

With the input tag, we will all use it in Weixin Mini Programs (Mini). It must also be able to do it at once, but some commonly used attributes cannot be used according to habits:

Let me give you an example of what I use most:

Read one by one:

First of all, I defined his id, which is our most commonly used, so I assigned an id, after all, do not operate him, and why set it as an input box, second, set his style, third, set his input category, the above are very simple fourth. Use regular l; ai to restrict input to pure numbers. This may be a bit unclear, this is to monitor his keyup event, ignoring the list that is not purely numerical. Note that it is for the whole, not for screening. Fifth, limit his input to a maximum of 6 digits. Sixth, input event monitoring. This is exclusive to WeChat. The seventh event will be given below. Set his 'prompt' when the input box is empty.

bindinput event:

bind, as the name implies, bind input

The events were 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); } //modify total here},

It's an excerpt, so don't be curious about how it got here, you can see it. tapevent is defined as a function. And in this line of operation, I feel that WeChat is similar to Android. It's all about refreshing the page.

The above is all the contents of this article "How to use input tag in Weixin Mini Programs". Thank you for reading! I believe everyone has a great harvest after reading this article. Xiaobian will update different knowledge for everyone every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report