进来的随便看看,或许有帮助
vue+element-ui datepicker 设置默认日期
用的框架是vue+element-ui ,以下是时间控件
<el-form-item label="月份">
<el-date-picker v-model="ct_month" type="month" placeholder="选择月份" format="yyyy 年 MM 月 " value-format="yyyy-MM"></el-date-picker>
</el-form-item>
由于我需要显示的是默认月份而不是具体时间日期,你们需要的可以换成
type="date"
format="yyyy 年 MM 月dd日 "
具体设置请移步
http://element-cn.eleme.io/#/zh-CN/component/date-picker
设置默认属性
ct_month: null,
方法:
getdatatime(){//默认显示今天
this.ct_month= new Date();
},
getdatatime(){//默认显示昨天
this.ct_month= new Date();
this.ct_month.setTime(this.ct_month.getTime() - 3600 * 1000 * 2