el-elementUI使用el-date-picker選擇年月
更新時間:2024年02月05日 15:50:09 作者:small面包
本文主要介紹了el-elementUI使用el-date-picker選擇年月,文中通過示例代碼介紹的非常詳細,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
基于時間周期控件實現(xiàn)月周期、年周期的選擇

<el-date-picker
v-model="gysForm.year"
type="year"
placeholder="選擇日期"
format="yyyy"
value-format="yyyy"
style="width: 100%;"
:picker-options="pickerOptions"
/>
data(){
return{
gysForm:{
year:''
}
}
},
methods:{
pickerOptions: {
//disabled為函數(shù),返回值為布爾值,
disabledDate: (time) => {
let minYear = new Date().getFullYear() - 30
return time > Date.now() || time.getTime() < new Date(JSON.stringify(minYear))
}
},
}
選擇年月

<el-date-picker v-model="selectMonth" type="month" placeholder="選擇月" @change="jobSearch" value-format="yyyy-MM"></el-date-picker>
<script>
export default {
data() {
return {
selectMonth:''
}
},
created() {
this.initData({});
},
methods: {
jobSearch() {
this.getJobListByMonth();
},
async initData(data) {
//獲取當前時間
var now = new Date();
var monthn = now.getMonth()+1;
var yearn = now.getFullYear();
this.selectMonth = yearn+"-"+monthn;
this.selectUser = parseInt(sessionStorage.getItem("userid"));
// this.getWeekJobList({
// userid: sessionStorage.getItem("userid"),
// weekid: "1"
// });
this.getJobListByMonth();
},
async getJobListByMonth(data) {
}
}
}
</script>到此這篇關(guān)于el-elementUI使用el-date-picker選擇年月的文章就介紹到這了,更多相關(guān)el-element el-date-picker內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
vuex如何在非組件中調(diào)用mutations方法
這篇文章主要介紹了vuex如何在非組件中調(diào)用mutations方法,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-03-03
vue?路由跳轉(zhuǎn)打開新窗口被瀏覽器攔截問題處理
這篇文章主要介紹了vue?路由跳轉(zhuǎn)打開新窗口被瀏覽器攔截問題處理,下面文章操作中所遇到相關(guān)問題解決的內(nèi)容介紹詳細,需要的小伙伴可以參考一下2022-03-03

