This article example shares the specific code for using Element+vue to implement start and end time limits for your reference. The specific content is as follows Effect <el-form-item label="Start time"> <el-date-picker v-model="startDate" type="datetime" placeholder="Select a date" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp" :editable="false" :picker-options="pickerOptionsStart" @change="changeStart"> </el-date-picker> </el-form-item> <el-form-item label="End time"> <el-date-picker v-model="endDate" type="datetime" placeholder="Select a date" style="width: 100%;" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp" :clearable="true" :editable="false" :picker-options="pickerOptionsEnd" @change="changeEnd"> </el-date-picker> </el-form-item> pickerOptionsStart: {}, pickerOptionsEnd: {}, startDate: '', endDate: '', changeStart() { // Limit the start time if (this.endDate != '') { if (this.endDate <= this.startDate) { this.$message.warning('End time must be greater than start time!'); this.startDate = ''; } } this.pickerOptionsEnd = Object.assign({}, this.pickerOptionsEnd, { disabledDate: (time) => { if (this.startDate) { return time.getTime() < this.startDate; } }, }); }, changeEnd() { // Limit end time console.log(this.endDate); if (this.startDate != '') { if (this.endDate <= this.startDate) { this.$message.warning('End time must be greater than start time!'); this.endDate = ''; } } this.pickerOptionsStart = Object.assign({}, this.pickerOptionsStart, { disabledDate: (time) => { if (this.endDate) { return time.getTime() > this.endDate; } }, }); }, The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Nginx installation error solution
>>: Analysis of Linux configuration to achieve key-free login process
The simple installation configuration of mysql5.7...
When we are writing projects, we often encounter ...
[LeetCode] 181.Employees Earning More Than Their ...
mysql copy one table column to another table Some...
Table of contents Preface 1. Custom focus command...
Table of contents 1. Route navigation 2. History ...
Use scenarios: The project's pages need to lo...
This article example shares the specific code of ...
Function currying (black question mark face)? ? ?...
1. Background The following two problems are enco...
I just installed Ubuntu and there was no network ...
When newbies develop div+css, they need to name t...
This article shares the specific code of Vue to i...
Table of contents Overview Functionality and read...
Here are two ways to install MySQL under Linux: y...