xiugai
This commit is contained in:
@@ -46,7 +46,11 @@ export default {
|
||||
leftMargin: {
|
||||
type: [String, Number],
|
||||
default: '350px' // 默认值设为350px
|
||||
}
|
||||
},
|
||||
dateData: {
|
||||
type: Object,
|
||||
default: {} // 默认值设为350px
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -75,11 +79,26 @@ export default {
|
||||
this.date = undefined;
|
||||
// this.emitTimeRange();
|
||||
}
|
||||
},
|
||||
dateData: {
|
||||
immediate: true, // 初始化时立即执行
|
||||
handler(newVal) {
|
||||
console.log('newVal', newVal);
|
||||
|
||||
if (newVal && (newVal.startTime || newVal.endTime)) {
|
||||
// 优先使用 startTime 转换为月份格式
|
||||
const timeStamp = newVal.startTime || newVal.endTime;
|
||||
if (timeStamp !== 0) {
|
||||
const monthStr = moment(timeStamp).format('YYYY-MM');
|
||||
this.date = monthStr; // 赋值给选择器
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 初始化默认日期(当前月,格式:yyyy-MM)
|
||||
console.log(this.$router);
|
||||
// console.log(this.$router);
|
||||
this.date = moment().format('YYYY-MM');
|
||||
this.$nextTick(() => this.emitTimeRange());
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user