current position:Home>Vue---element-ui--date picker component start time and end time are grayed out
Vue---element-ui--date picker component start time and end time are grayed out
2022-06-24 09:57:50【Strawberry chocolate beans】
Style effect :
When the start time is selected , Then choose the end time , In the end schedule item , The date before the start time is grayed out and cannot be selected .
Code samples :
If some attributes are not understood , Please refer to the official website Introduction to the time selector component
<el-form :model="createForm" ref="ruleForm" :rules="rules">
<el-form-item
label=" Regular time "
width="400"
label-width="72px"
style="margin-bottom: 0px;"
>
<el-form-item
:prop="`tipMessageDates`"
:rules="rules.tipMessageRuleDates"
>
<el-date-picker
v-model="tipMessageDates.startDate"
type="date"
:picker-options="startPickerOptions"
@focus="onFocus(tipMessageDates)"
value-format="yyyy-MM-dd"
placeholder=" Starting time "
>
</el-date-picker
><span style="margin: 0 10px;"> to </span>
<el-date-picker
v-model="tipMessageDates.endDate"
type="date"
:picker-options="endPickerOptions"
@focus="onFocus(tipMessageDates)"
value-format="yyyy-MM-dd"
placeholder=" End time "
>
</el-date-picker>
</el-form-item>
</div>
</el-form-item>
</el-form>
data(){
return {
endPickerOptions: any = this.processDate() // End time grayed out
startPickerOptions: any = this.beginDate() // Start time is grayed out
nowDate: any = null // Currently selected time
}
}
methods:{
// Time input is clicked
onFocus(data: any) {
this.nowDate = data
}
// Start time is grayed out
beginDate() {
let self: any = this
return {
disabledDate(time: any) {
if (self.nowDate.endDate) {
return new Date(self.nowDate.endDate).getTime() < time.getTime()
} else {
return false
}
}
}
}
// End time grayed out
processDate() {
let self: any = this
return {
disabledDate(time: any) {
if (self.nowDate.startDate) {
return (
new Date(self.nowDate.startDate).getTime() - 8.64e7 > time.getTime()
)
} else {
return false
}
}
}
}
}
copyright notice
author[Strawberry chocolate beans],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/175/202206240807060742.html
The sidebar is recommended
- () is a linear table that restricts the internal structure of data elements to only one character. A. Stack B. queue C. string D. array
- TS cannot find global variable for NPM package
- Java, what should I do if there is an edit configuration in the idea when it runs
- C++ code. Freshmen have just come into contact with this language
- Tnsnames Ora file configuration
- Handling method of Oracle data file header SCN inconsistency
- Oracle database listening file configuration
- Oracle database expdp only exports tables
- Windows method for checking network port occupation and kill process
- Oracle viewing data file header SCN information
guess what you like
Ora-28000 error after upgrading Oracle 12C to 19C
[talk about serviceregistryendpoint of springcloud]
[springcloud service registration and anti registration AOP interception]
[springboot source code analysis - @endpoint annotation validation principle analysis]
[elegant offline and grayscale release of spring cloud]
PostgreSQL
Reactnative 0.69 release
The new design can be called a new generation. The gradient borderless grille has a high appearance value. The application drawing of Changan Ruicheng plus
Linux general command summary
Render external link address URL video page via iframe - Vue
Random recommended
- Detailed explanation of Linux system tuning (VII) -- network status viewing command nethogs
- Vue failed to parse source for import analysis because the content contains invalid JS syntax
- Differences between front-end set and map
- Difference between front-end foreach and map
- Front end array flattening
- How the front end judges the data type
- Front end CSS style expand and collapse
- Front end array de duplication
- Front end throttling and anti shake
- Analysis of 43 cases of MATLAB neural network: Chapter 33 prediction algorithm of fuzzy neural network -- water quality evaluation of Jialing River
- Java & c++ problem solving and expansion -- leetcode30 Concatenate substrings of all words [new knowledge of Mo]
- Eclipse customizes and calls the header file [c/c++]
- Detailed explanation of Vue Foundation
- Unity determines whether all toggles are selected or not
- Program reverse output and print results
- Ubuntu modify time zone
- Linux Installation maven
- Okhttp source code analysis of Android network framework
- Android adds system service interfaces and test cases
- Ubuntu deployment according to Vue version
- Thinkphp5 clear the cache cache, temp cache and log cache under runtime
- Springboot + JWT + redis open source knowledge community system
- Why is JSX syntax so popular?
- The actual test of fluent IOS -- worth collecting
- Front and rear end cross domain issues
- Record the range of data that MySQL update will lock
- Springboot + JWT + redis open source knowledge community system
- 1 minute serverless set up a real website to lead the cat super card: scene experience of "set up nails at a high speed to broadcast the weather regularly"
- 1 minute serverless quickly build a real website to lead the cat super card: scene experience of "rapidly build a zblog blog system"
- Vue eventbus value transfer between brother components
- Array seamless scrolling demo
- Echorts auto play
- Class object oriented programming idea
- elementui utils/clickoutside. JS click element external trigger
- SQL statistics of users logged in for N consecutive days
- Vue3 network request adding loading
- Explain the specific calculation of string hashcode in Java
- Open Oracle server under Linux to allow remote connection
- Properties and simple realization of red black tree
- Vue component introduction and page Jump