|
80 | 80 | * 当前日期 |
81 | 81 | */ |
82 | 82 | date: { |
83 | | - type: null, |
84 | | - default: () => { |
85 | | - return new Date(); |
86 | | - } |
| 83 | + type: String, |
| 84 | + default: '' |
87 | 85 | }, |
88 | 86 | /** |
89 | 87 | * 打点日期 |
|
160 | 158 | this.getMonthAll(0, this.date, true); |
161 | 159 | } else { |
162 | 160 | this.getMonthAll(1, this.date, true); |
163 | | - setTimeout(() => { |
164 | | - this.getQueryDom(1); |
165 | | - }, 300); |
| 161 | + this.getQueryDom(1); |
| 162 | +
|
166 | 163 | } |
167 | 164 | }, |
168 | | - computed: {}, |
169 | 165 | watch: { |
170 | 166 | selected(newVal) { |
171 | 167 | let canlender = this.canlender; |
|
204 | 200 | * 获取全部月份 |
205 | 201 | */ |
206 | 202 | getMonthAll(index, date, first) { |
| 203 | + if (date === '') { |
| 204 | + date = new Date(); |
| 205 | + } |
207 | 206 | let canlender = this.getWeek(date); |
208 | 207 | this.currentSelDate = canlender.date; |
209 | 208 | let tempyear = canlender.year + '-' + canlender.month + '-1'; |
|
305 | 304 | * 今天之前的日期是否可选 |
306 | 305 | */ |
307 | 306 | isDisableBefore(year, month, date) { |
| 307 | + let nowDate = this.date ? this.date : new Date(); |
308 | 308 | let time = year + '-' + month + '-' + date; |
309 | 309 | let startDate = false; |
310 | 310 | let endDate = false; |
|
318 | 318 | if (this.disableBefore) { |
319 | 319 | if (!this.startDate) { |
320 | 320 | if (!this.endDate) { |
321 | | - return !this.dateCompare(this.getDate(this.date, 0), time); |
| 321 | + return !this.dateCompare(this.getDate(nowDate, 0), time); |
322 | 322 | } else { |
323 | | - return !this.dateCompare(this.getDate(this.date, 0), time) || endDate; |
| 323 | + return !this.dateCompare(this.getDate(nowDate, 0), time) || endDate; |
324 | 324 | } |
325 | 325 | } else { |
326 | 326 | return ( |
327 | | - !this.dateCompare(this.getDate(this.date, 0), time) || !startDate || endDate |
| 327 | + !this.dateCompare(this.getDate(nowDate, 0), time) || !startDate || endDate |
328 | 328 | ); |
329 | 329 | } |
330 | 330 | } else { |
|
381 | 381 | } else { |
382 | 382 | num = 1; |
383 | 383 | } |
384 | | - console.log(num); |
385 | 384 | let year = |
386 | 385 | this.canlender.year + '-' + this.canlender.month + '-' + this.canlender.date; |
387 | 386 |
|
|
600 | 599 | * 计算时间大小 |
601 | 600 | */ |
602 | 601 | dateCompare(startDate, endDate) { |
603 | | - //计划截止时间 |
604 | | - var startDate = new Date(startDate.replace('-', '/').replace('-', '/')); |
605 | | - //计划详细项的截止时间 |
606 | | - var endDate = new Date(endDate.replace('-', '/').replace('-', '/')); |
| 602 | + //计算截止时间 |
| 603 | + startDate = new Date(startDate.replace('-', '/').replace('-', '/')); |
| 604 | + //计算详细项的截止时间 |
| 605 | + endDate = new Date(endDate.replace('-', '/').replace('-', '/')); |
607 | 606 | if (startDate <= endDate) { |
608 | 607 | return true; |
609 | 608 | } else { |
|
612 | 611 | }, |
613 | 612 | getQueryDom(index) { |
614 | 613 | let dom = uni.createSelectorQuery().selectAll(`.${this.elClass}`); |
615 | | -
|
616 | 614 | dom.boundingClientRect(rect => {}).exec(e => { |
| 615 | + if (!e[0]) { |
| 616 | + this.getQueryDom(1); |
| 617 | + return; |
| 618 | + } |
617 | 619 | if (e[0][index]) { |
618 | 620 | this.domHeihgt = e[0][index].height; |
619 | 621 | } |
|
0 commit comments