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 implement date Selector in WeChat Mini Programs

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Today, the editor will share with you the relevant knowledge about how to implement the date selector in WeChat Mini Programs. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article, let's take a look at it.

Go to gif:

The above code:

1.index.js

/ / index.js / / get the application instance var app = getApp () Page ({data: {date: '2016-11-08, time:' 12 Page, array: ['China', 'Brazil', 'Japan', 'USA'], index: 0,}, onLoad: function () {} / / Click time component to determine event bindTimeChange: function (e) {this.setData ({time: e.detail.value})}, / / Click date component to determine event bindDateChange: function (e) {this.setData ({date: e.detail.value})} / Click the country component to determine the event bindPickerChange: function (e) {this.setData ({index: e.detail.value})}) 2.index.wxml [html] view plain copy country: {{array [index]}} time: {{time}} date: {{date}}

① ordinary selector

The selector is distinguished by mode. The default is a normal selector. E.detail.value gets the value from the index index of the selected item, and then gets the value through array. When initializing in data, add the option to array.

When selected, the bindPickerChange event is triggered to get the index.

② time selector

When mode = time, it is the time selector. Start and end are the beginning and end of the valid time range, respectively. Format hh:mm

When selected, the bindTimeChange event is triggered to get the time.

③ date Selector

When mode = date, it is the time selector. Start and end are the start and end of the valid date range, respectively. Format yyyy-MM-dd

BindDateChange event is triggered when selecting, and date is obtained.

These are all the contents of the article "how to realize the date Selector in WeChat Mini Programs". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you 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: 288

*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