網(wǎng)站首頁 編程語言 正文
概要
element上有一種月份期間的選擇框,可在一個選擇器中便捷地選擇一個月份范圍,但是我們的需求是用兩個月份選擇器,一個選擇器為開始時間,一個為結(jié)束時間,結(jié)束時間只能選擇開始時間以后的月份。效果如下圖:
全部代碼
代碼很簡單,就不解釋了。
<template>
<div class="home">
<el-form>
<el-row>
<el-row>
<el-col :span="6">
<!-- 開始月份 -->
<el-form-item label="開始月份">
<el-date-picker
v-model="queryConditionFrom.beginMonth"
type="month"
value-format="yyyyMM"
placeholder="選擇月">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="6">
<!-- 結(jié)束月份 -->
<el-form-item label="結(jié)束月份">
<el-date-picker
v-model="queryConditionFrom.endMonth"
type="month"
value-format="yyyyMM"
placeholder="選擇月"
:picker-options="pickerOptions"
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-row>
</el-form>
</div>
</template>
<script>
// @ is an alias to /src
export default {
name: 'Home',
components: {
},
data(){
return{
queryConditionFrom:{
beginMonth:'',
endMonth:'',
},
pickerOptions:{},
}
},
methods:{
},
watch:{
"queryConditionFrom.beginMonth"(newDate,oldDate){
this.pickerOptions={
disabledDate(time){
let timeyear = time.getFullYear();
let timemonth = time.getMonth()+1;
if(timemonth>=1 && timemonth<=9){
timemonth = "0" + timemonth;
}
const elTimeDate = timeyear.toString()+ timemonth.toString();
if(newDate){
return elTimeDate<newDate
}
}
}
}
}
}
</script>
原文鏈接:https://blog.csdn.net/shensa5556/article/details/122100353
相關(guān)推薦
- 2022-07-15 Python中列表索引?A[?:?2?]與A[?:?,?2]的區(qū)別說明_python
- 2022-06-20 Python基于DFA算法實現(xiàn)內(nèi)容敏感詞過濾_python
- 2022-12-29 React使用公共文件夾public問題_React
- 2022-12-28 React?Server?Component混合式渲染問題詳解_React
- 2021-12-09 Wide&Deep Model、Wide Model(LR)、Deep Model、Deep
- 2022-05-26 .Net解決引用程序集沒有強名稱報錯_實用技巧
- 2022-03-30 py3nvml實現(xiàn)GPU相關(guān)信息讀取的案例分析_python
- 2022-04-20 Python?設(shè)計模式中的創(chuàng)建型建造者模式_python
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支