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 input text in input Space in the Development of WeChat Mini Programs

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

Share

Shulou(Shulou.com)06/02 Report--

This article "how to input text in input space in the development of WeChat Mini Programs", the sample code in this article is very detailed and has certain reference value. Interested friends must refer to "how to realize input text in input space in the development of WeChat Mini Programs". The editor has sorted out the following knowledge points, please follow the pace of the editor to understand step by step. Next, let's get to the subject.

1. How to clear the input text in input space in WeChat Mini Programs

Scenario: after you want to read the input of the input control, empty the contents of the input box. As I am a js rookie, I spent a whole hour or two without finding a way.

It turns out that WeChat Mini Programs does not support document's method of obtaining controls through id. Although the compiler does not report errors, it actually does not work. I tested it myself.

It can only be achieved through data transfer, as follows:

Function: press the control "input", and then the input input box will be empty

[javascript] view plain copy print?//input.wxml---- add control "Please enter query statement" confirm-type = "send" value= "{{searchinput}}" / > "primary" size= "mini" style= "background:#d0e0e3;color:#000000" bindtap= "BeginSearch" > clear the input data of the input control {{searchinput}}, and then empty it in the js file of the corresponding page:

[javascript] view plain copy print?Page ({data: {searchinput:''} BeginSearch:function (e) {this.setData ({searchinput:'',})})

2. Promise cannot be used

Add this.use ('promisify') to the constructor in app.wpy

3. How to close (open) ESlint?

Set eslint to false (true) within the project wepy.config.js

4. WeChat Mini Programs's time to deal with the problem

Environment:

Development environment:

1. Mac OS 10.12.5

two。 Wechat Web developer tools v0.18.182200

Test environment:

1. IPhone 7

2. IOS 10.3.2

3. Wechat 6.5.9

Problem phenomenon:

In the process of developing Mini Program, you need to convert a date string-for example, var dateString = '2017-06-25' into a timestamp. The method used is the parse () method of the Date object: Date.parse (dateString)

When the Wechat Web developer tool is developing locally, this method has no problem and can normally return a 13-bit millisecond timestamp. However, when the mobile phone is used to scan the code in Wechat to preview Mini Program, the return value of this method is null.

Solution:

Change the hyphen of the heavy date string from-to /, that is, change var dateString = '2017-06-25' to var dateString = '2017Greater 06 25' can solve the problem that the iOS version of WeChat Mini Programs Date.parse (dateString) returns null.

What is the advantage of Mini Program Mini Program compared with developers, Mini Program is less difficult to develop, can save development and operating costs, so that developers can quickly develop a Mini Program. And Mini Program can be easily obtained and spread in Wechat, which can meet the basic life applications, in line with life services offline stores and non-rigid needs of low-frequency applications. For users, it can save time cost and mobile phone memory space, and have excellent use experience at the same time.

These are all the contents of the article "how to input text in input space in the development of WeChat Mini Programs". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow 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