This commit is contained in:
2024-02-08 13:55:41 +08:00
parent a9031233fe
commit 10e42047e6
7 changed files with 372 additions and 32 deletions

View File

@@ -59,7 +59,8 @@
<view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex">
<view class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex">
<calendar-item class="uni-calendar-item--hook" :weeks="weeks" :calendar="calendar"
:selected="selected" :checkHover="range" @change="choiceDate" @handleMouse="handleMouse" :disabledDate="disabledDate">
:selected="selected" :checkHover="range" @change="choiceDate" @handleMouse="handleMouse"
:disabledDate="disabledDate">
</calendar-item>
</view>
</view>
@@ -347,10 +348,12 @@
},
computed: {
timepickerStartTime() {
console.log("timepickerStartTime", this.calendar);
const activeDate = this.range ? this.tempRange.before : this.calendar.fullDate
return activeDate === this.startDate ? this.selectableTimes.start : ''
},
timepickerEndTime() {
console.log("timepickerEndTime", this.calendar);
const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate
return activeDate === this.endDate ? this.selectableTimes.end : ''
},
@@ -565,9 +568,31 @@
* @param {Object} name
*/
setEmit(name) {
console.log("setEmit ", name)
console.log("calendar ", this.calendar)
console.log("cale ", this.cale)
console.log("this.calendar ", this.calendar)
console.log("getFullYear ", new Date().getFullYear())
console.log("getMonth", new Date().getMonth() + 1)
console.log("getDate", new Date().getDate())
var nowDate = new Date()
var time = {
year: nowDate.getFullYear(),
month: nowDate.getMonth() + 1,
day: nowDate.getDate()
}
var applyDate = time.year + '-' + (time.month >= 10 ? time.month : '0' + time.month) + '-' + (time.day >=
10 ? time.day : '0' + time.day)
console.log("applyDate", applyDate)
if (!this.range) {
if (!this.calendar.fullDate) {
this.calendar = this.cale.getInfo(new Date())
this.calendar.fullDate = applyDate
// this.calendar = this.cale.getInfo(applyDate)
// console.log("calendar222 ", this.calendar)
this.tempSingleDate = this.calendar.fullDate
}
if (this.hasTime && !this.time) {
@@ -597,12 +622,12 @@
* @param {Object} weeks
*/
choiceDate(weeks) {
if (weeks.disable)
return
if(this.disabledDate.includes(weeks.fullDate)){
if (weeks.disable)
return
if (this.disabledDate.includes(weeks.fullDate)) {
return
}
this.calendar = weeks
this.calendar.userChecked = true
// 设置多选
@@ -637,12 +662,13 @@
* @param {Object} date
*/
setDate(date) {
console.log("this.weeks88 ", date)
console.log("this.date ", date)
this.cale.setDate(date)
console.log("this.weeks88 ", this.cale)
console.log("this.cale ", this.cale)
this.weeks = this.cale.weeks
console.log("this.weeks88 ", this.weeks)
console.log("this.weeks ", this.weeks)
this.nowDate = this.cale.getInfo(date)
console.log("this.nowDate ", this.nowDate)
}
}
}