further work on MonthPicker

This commit is contained in:
Sockenklaus
2021-10-03 12:36:12 +02:00
parent 1ed7cdada8
commit e304767f32
2 changed files with 6 additions and 23 deletions

View File

@@ -26,7 +26,7 @@
<table class="table table-bordered mt-2">
<tbody>
<tr v-for="n in 3">
<td v-for="m in 4" @click="selectedMonth = m+4*n-5" :class="{selected: selectedMonth===(m+4*n-5)}">
<td v-for="m in 4" @click="selectedMonth = m+4*n-5" :class="{ 'table-active': selectedMonth === (m+4*n-5)}">
{{months[m+4*n-5]}}
</td>
</tr>
@@ -39,7 +39,7 @@
</template>
<script setup lang="ts">
import { ref, computed, watch, Ref, ComputedRef } from 'vue'
import { ref, watch, Ref } from 'vue'
const props = defineProps<{
selectedMonth: number,
@@ -57,20 +57,6 @@
'Sept', 'Okt', 'Nov', 'Dez'
]
/**
* -4 -3 -2
* -1 0 +1
* +2 +3 +4
*/
const years : ComputedRef<number[]> = computed(() => {
let arr : number[] = []
for (let i = 0; i < 9; i++) {
arr.push(selectedYear.value - 4 + i)
}
return arr
})
const emit = defineEmits<{
(e: 'getYear', year: number): number
(e: 'getMonth', month: number): number