- A+
所属分类:Web前端
//html: <el-form-item label="开始日期" prop="cxBeginTime"> <el-date-picker v-model="queryParams.cxBeginTime" type="date" placeholder="选择开始日期"> </el-date-picker value-format="yyyy-MM-dd" format="yyyy-MM-dd"> </el-form-item> //data: queryParams:{cxBeginTime:'',cxEndTime:''}, // computed: { timeDefault() { var date = new Date(); var s1 = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + (date.getDate()+1); return s1; } }, mounted() { // 初始化查询,默认为后一天 this.$set(this.queryParams,"cxBeginTime",this.timeDefault) this.$set(this.queryParams,"cxEndTime",this.timeDefault) },
mounted()里面,不要用 this.ruleForm.dateValue = this.timeDefault; 这种方式赋值,本文参考 【https://blog.csdn.net/XZZ2222/article/details/91806591?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param】