Skip to content

Commit 5ae0bf2

Browse files
Fix issue of card position when compponent mounted a la carte
1 parent 6b1f611 commit 5ae0bf2

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/playground/configs/playground.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const app = createApp(PlaygroundApp);
1212
app.use(createVColorField());
1313
app.use(createPinia());
1414
app.component('font-awesome-icon', FontAwesomeIcon);
15+
1516
app.component('FaIcon', FontAwesomeIcon);
1617

1718
registerPlugins(app);

src/plugin/VColorField.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,11 @@ const pickerMode = ref<Mode>(defaults.value.VColorPicker?.mode);
329329
const themeAll = ref(settings.theme ?? undefined);
330330
let textFieldProperties = reactive<TextFieldProperties>({
331331
bottom: 0,
332-
height: 0,
332+
height: 150,
333333
left: 0,
334334
right: 0,
335335
top: 0,
336-
width: 0,
336+
width: 300,
337337
});
338338
339339
// ------------------------- Pip //
@@ -432,6 +432,7 @@ function toggleColorPicker(trigger?: string | Event): void {
432432
let inputWidth: number = 300;
433433
let positionLeft = fieldElementCoords?.left ?? 0;
434434
let positionRight = fieldElementCoords?.right ?? 0;
435+
const positionTop = fieldElementCoords?.top ?? 0;
435436
436437
const fieldInputContainer: HtmlRefElement = fieldContainerRef?.value?.querySelector('.v-field__input');
437438
const fieldContainerInputCoords = fieldInputContainer?.getBoundingClientRect() ?? defaultCoords;
@@ -446,7 +447,7 @@ function toggleColorPicker(trigger?: string | Event): void {
446447
height: inputHeight as number,
447448
left: positionLeft,
448449
right: positionRight,
449-
top: (window.scrollY + fieldElementCoords?.top ?? 0),
450+
top: (window.scrollY + positionTop),
450451
width: settings.cardFieldWidth ? inputWidth : 'auto',
451452
};
452453

0 commit comments

Comments
 (0)