fix
This commit is contained in:
parent
ee4f203e0b
commit
7b1a4edf64
|
@ -56,6 +56,8 @@ export type Tab<K = string> = {
|
||||||
import { nextTick, onMounted, onUnmounted, useTemplateRef, watch } from 'vue';
|
import { nextTick, onMounted, onUnmounted, useTemplateRef, watch } from 'vue';
|
||||||
import { prefer } from '@/preferences.js';
|
import { prefer } from '@/preferences.js';
|
||||||
|
|
||||||
|
const cssAnchorSupported = CSS.supports('position-anchor', '--anchor-name');
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
tabs?: T[];
|
tabs?: T[];
|
||||||
centered?: boolean;
|
centered?: boolean;
|
||||||
|
@ -65,7 +67,6 @@ const props = withDefaults(defineProps<{
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(ev: 'update:tab', key: string);
|
|
||||||
(ev: 'tabClick', key: string);
|
(ev: 'tabClick', key: string);
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
@ -74,10 +75,10 @@ const tab = defineModel<T['key']>('tab');
|
||||||
const tabHighlightEl = useTemplateRef('tabHighlightEl');
|
const tabHighlightEl = useTemplateRef('tabHighlightEl');
|
||||||
const tabRefs: Record<string, HTMLElement | null> = {};
|
const tabRefs: Record<string, HTMLElement | null> = {};
|
||||||
|
|
||||||
function onTabMousedown(tab: Tab, ev: MouseEvent): void {
|
function onTabMousedown(selectedTab: Tab, ev: MouseEvent): void {
|
||||||
// ユーザビリティの観点からmousedown時にはonClickは呼ばない
|
// ユーザビリティの観点からmousedown時にはonClickは呼ばない
|
||||||
if (tab.key) {
|
if (selectedTab.key) {
|
||||||
emit('update:tab', tab.key);
|
tab.value = selectedTab.key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ function onTabClick(t: Tab, ev: MouseEvent): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t.key) {
|
if (t.key) {
|
||||||
emit('update:tab', t.key);
|
tab.value = t.key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue