写项目的时候碰到的
<el-form-item label=" " :rules="[ { required: true, message: '请选择入职时间', trigger: 'blur' } ]" prop="inJopDate" > <div class="el-input el-input--medium el-input-group el-input-group--prepend" > <div class="el-input-group__prepend">入职时间</div> <el-date-picker v-model="modelForm.inJopDate" style="100%" type="date" value-format="yyyy-MM-dd" placeholder="请选择入职时间" /> </div> </el-form-item>
initData() {
this.optionsData = { ...this.$parent.optionsData };
if (!this.selectId) {
this.$http.get(this.url + "/create").then(data => {
if (data.status === 200) {
........此处省略......
let time = new Date();
let inJob =
time.getFullYear() +
"-" +
(time.getMonth() + 1) +
"-" +
time.getDate();
this.$set(this.modelForm, "inJopDate", inJob);
}
});
} else {.....}