|
@@ -2,7 +2,14 @@
|
|
|
<div class="date-temp">
|
|
|
<span class="arrow-left" @click="pickerChangeLeft"></span>
|
|
|
<span class="arrow-line arrow-line1" @click="pickerChangeLeft"></span>
|
|
|
- <el-date-picker v-model="pickerVal" type="date" format="yyyy.MM.dd" value-format="yyyy.MM.dd"></el-date-picker>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="pickerVal"
|
|
|
+ type="date"
|
|
|
+ format="yyyy.MM.dd"
|
|
|
+ value-format="yyyy.MM.dd"
|
|
|
+ @change="changeDate"
|
|
|
+ :picker-options="pickerOptions0"
|
|
|
+ ></el-date-picker>
|
|
|
<span class="arrow-line" @click="pickerChangeRight"></span>
|
|
|
<span class="arrow-right" @click="pickerChangeRight"></span>
|
|
|
</div>
|
|
@@ -13,7 +20,12 @@ import "moment/locale/zh-cn";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- pickerVal: new Date()
|
|
|
+ pickerVal: new Date(),
|
|
|
+ pickerOptions0: {
|
|
|
+ disabledDate(time) {
|
|
|
+ return time.getTime() > Date.now();
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
props: ["date"],
|
|
@@ -56,6 +68,9 @@ export default {
|
|
|
}
|
|
|
this.$emit("pickerVal", this.pickerVal);
|
|
|
},
|
|
|
+ changeDate(val) {
|
|
|
+ this.$emit("pickerVal", val);
|
|
|
+ },
|
|
|
formatterStr(str) {
|
|
|
if (str) {
|
|
|
return (
|
|
@@ -70,9 +85,8 @@ export default {
|
|
|
},
|
|
|
mounted() {
|
|
|
if (this.date) {
|
|
|
- this.pickerVal = this.formatterStr(
|
|
|
- new Date().getFullYear() + this.formatterStr2(this.date)
|
|
|
- );
|
|
|
+ this.pickerVal = this.formatterStr(this.date);
|
|
|
+ // new Date().getFullYear() + this.formatterStr2(this.date)
|
|
|
this.$emit("pickerVal", this.pickerVal);
|
|
|
}
|
|
|
}
|