Skip to content
This repository was archived by the owner on Apr 17, 2022. It is now read-only.

Commit a0a9241

Browse files
committed
fix: Overlay correct position with ref
1 parent 57560fe commit a0a9241

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/Vue3DatePicker/Vue3DatePicker.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@
113113
WeekStartNum,
114114
WeekStartStr,
115115
} from './interfaces';
116-
// import { clickOutsideDirective as vClickOutsideDirective } from './directives/clickOutside';
117116
import { getDateHours, getDateMinutes, getDefaultPattern } from './utils/date-utils';
118117
import { getDefaultTextInputOptions, getDefaultFilters } from './utils/util';
119118
import { usePosition } from './components/composition/position';

src/Vue3DatePicker/components/SelectionGrid.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
@click="onClick(col.value)"
1212
:aria-selected="col.value === modelValue && !disabledValues.includes(col.value)"
1313
:aria-disabled="col.className.dp__overlay_cell_disabled"
14-
:ref="col.value === modelValue && !disabledValues.includes(col.value) ? `selectionActiveRef` : ''"
14+
:ref="
15+
(el) => {
16+
if (col.value === modelValue && !disabledValues.includes(col.value))
17+
selectionActiveRef = el;
18+
}
19+
"
1520
>
1621
<div :class="col.className">
1722
<slot v-if="$slots.item" name="item" :item="col" />
@@ -33,7 +38,7 @@
3338
</template>
3439

3540
<script lang="ts" setup>
36-
import { computed, onMounted, PropType, ref } from 'vue';
41+
import { computed, onBeforeUpdate, onMounted, PropType, ref } from 'vue';
3742
3843
import { IDefaultSelect, DynamicClass } from '../interfaces';
3944
import { getKey, unrefElement } from '../utils/util';
@@ -52,6 +57,10 @@
5257
const selectionActiveRef = ref(null);
5358
const gridWrapRef = ref(null);
5459
60+
onBeforeUpdate(() => {
61+
selectionActiveRef.value = null;
62+
});
63+
5564
/**
5665
* On mounted hook, set the scroll position, if any to a selected value when opening overlay
5766
*/

0 commit comments

Comments
 (0)