Refactored Schedule.vue contain more than one month. Started working on selecting cells.
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
|
||||
MonthPicker(:selectedMonth="selectedMonth" :selectedYear="selectedYear" @getMonth="selectedMonth = $event" @getYear="selectedYear = $event")
|
||||
|
||||
div(class="mt-5" v-for="(month, index) in months" :key="index")
|
||||
Schedule( :startDate="months[index]" :initialOffset="iOffsets[index]")
|
||||
Schedule( :startDate="new Date(selectedYear, selectedMonth)")
|
||||
|
||||
</template>
|
||||
|
||||
@@ -15,24 +14,4 @@ div(class="mt-5" v-for="(month, index) in months" :key="index")
|
||||
|
||||
const selectedMonth = ref(getMonth(new Date()))
|
||||
const selectedYear = ref(getYear(new Date()))
|
||||
|
||||
const months = computed(() => {
|
||||
return eachMonthOfInterval({
|
||||
start: new Date(selectedYear.value, selectedMonth.value),
|
||||
end : new Date(selectedYear.value, selectedMonth.value + 2)
|
||||
})
|
||||
})
|
||||
|
||||
const iOffsets = computed(() => {
|
||||
let arr : number[] = []
|
||||
arr.push(0)
|
||||
|
||||
months.value.forEach(month => {
|
||||
if ( getDaysInMonth(month) + getISODay(month) - 1 + arr[arr.length - 1] > 34) {
|
||||
arr.push(7)
|
||||
}
|
||||
else arr.push(0)
|
||||
})
|
||||
return arr
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user