refactor: 画面サイズのしきい値をconstにまとめる
This commit is contained in:
parent
e88fc369d9
commit
05ca36f400
9 changed files with 17 additions and 15 deletions
|
|
@ -48,6 +48,7 @@ import { scrollToTop } from '@/scripts/scroll.js';
|
|||
import { globalEvents } from '@/events.js';
|
||||
import { injectReactiveMetadata } from '@/scripts/page-metadata.js';
|
||||
import { $i, openAccountMenu as openAccountMenu_ } from '@/account.js';
|
||||
import { MOBILE_THRESHOLD } from '@/const.js';
|
||||
import { PageHeaderItem } from '@/types/page-header.js';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
|
|
@ -112,10 +113,10 @@ onMounted(() => {
|
|||
globalEvents.on('themeChanged', calcBg);
|
||||
|
||||
if (el.value && el.value.parentElement) {
|
||||
narrow.value = el.value.parentElement.offsetWidth < 500;
|
||||
narrow.value = el.value.parentElement.offsetWidth < MOBILE_THRESHOLD;
|
||||
ro = new ResizeObserver((entries, observer) => {
|
||||
if (el.value && el.value.parentElement && document.body.contains(el.value as HTMLElement)) {
|
||||
narrow.value = el.value.parentElement.offsetWidth < 500;
|
||||
narrow.value = el.value.parentElement.offsetWidth < MOBILE_THRESHOLD;
|
||||
}
|
||||
});
|
||||
ro.observe(el.value.parentElement as HTMLElement);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue