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 customize the validation date-time Selector for Vue

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

Share

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

This article mainly introduces Vue how to customize the verification date-time selector related knowledge, the content is detailed and easy to understand, the operation is simple and fast, with a certain reference value, I believe you will have something to gain after reading this Vue how to customize the verification date-time selector article, let's take a look at it.

Date-time selector for Vue custom validation

Custom verification of today's demand expected effect practical information value-format effect recommendation

Today's demand

In the query condition, when the start time and the end time are the same, the end time is greater than the start time.

Expected effect

Practical information export default {data () {/ / Custom Verification rules var createTimeCheck = (rule, value) Callback) = > {if (value = ='') {callback () / / callback function} else {let createTimeStart = this.createTime? This.createTime [0]:''/ / fetch start time from the array results: '2020-10-28 16 this.createTime 01 let createTimeEnd 15'? This.createTime [1]:'/ / end time of withdrawal let sTime = ((createTimeStart.split ('')) [1]). Split (':)). Join (') / from '2020-10-28 16 rides 01lav 15' take out time result: '160115' let sDate = ((createTimeStart.split (')) [0]) .split ('-') .join ('') / take-out start date result: '20201028' let endTime = (createTimeEnd.split (')) [1]). Split (':)) .join (') / / end time of withdrawal let endDate = ((createTimeEnd.split (')) [0]) .split ( ) .join (') / pull out end date if (parseInt (endDate) > parseInt (sDate)) {/ / if the end date is greater than the start date, do not judge the time callback ()} else {if (parseInt (endTime)) { Const endDateVal = new Date (this.timerEnd). GetTime () If (endDateVal) {return time.getTime () > endDateVal + 1;}, pickerOptionsEnd: {disabledDate: time = > {const beginDateVal = new Date (this.timerStart) .getTime () If (beginDateVal) {return time.getTime () < beginDateVal + 1;};}

This is the end of the article on "how to customize the validation date-time selector for Vue". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to customize the date and time selector for Vue". If you want to learn more, you are 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