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 add settings in the layDate component of layui starts in a week

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

Share

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

This article mainly introduces how to add settings in the layDate component of layui from the beginning of a week, with a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to know about it.

It is the international practice that Sunday is the beginning of the week, but some users prefer Monday as the beginning of the week. However, there is no configuration item in laydate to determine this. A configuration item has been added to laydatePro as follows:

You can also see from the comments that for ease of use, you can set 0 to 6 (that is, the value corresponding to Date.getDay ()), and provide these that can be set to the corresponding day one, two, three or Su,Mo,Tu.

Here is a brief introduction to the implementation logic behind it:

1. Add an initial value of weekStart to the default config

2. Use regular expression to verify that the filled value does not meet the requirements in render, and set it to the corresponding 0-6 if it does not meet the requirements.

3. When it comes to the actual rendering of the laydate, generate the nodes according to the weekStart

There are two parts here, one is shown on the th of the header

The other is the content of the actual td.

At this point, the setting for the beginning of the week has been changed. The example shows that it will be more common to use it from Monday, but it is not only set on Monday. In fact, it is supported to set any day as a start, followed by setting it according to the actual need.

Thank you for reading this article carefully. I hope the article "how to add the setting to start the week in the layDate component of layui" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and follow the industry information channel. More related knowledge is waiting for you to learn!

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