Skip to content
Snippets Groups Projects
Commit f8ed6b1a authored by syuilo's avatar syuilo
Browse files

refactor

parent 8709487c
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,7 @@
<button v-if="closeButton" v-tooltip="i18n.ts.close" class="_button" :class="$style.headerButton" @click="close()"><i class="ti ti-x"></i></button>
</span>
</div>
<div v-container :class="$style.content">
<div :class="$style.content">
<slot></slot>
</div>
</div>
......@@ -541,7 +541,7 @@ defineExpose({
flex: 1;
overflow: auto;
background: var(--panel);
container-type: inline-size;
container-type: size;
}
$handleSize: 8px;
......
import { Directive } from 'vue';
const map = new WeakMap<HTMLElement, ResizeObserver>();
export default {
mounted(el: HTMLElement, binding, vn) {
const ro = new ResizeObserver((entries, observer) => {
el.style.setProperty('--containerHeight', el.offsetHeight + 'px');
});
ro.observe(el);
map.set(el, ro);
},
unmounted(el, binding, vn) {
const ro = map.get(el);
if (ro) {
ro.disconnect();
map.delete(el);
}
},
} as Directive;
......@@ -11,7 +11,6 @@ import clickAnime from './click-anime';
import panel from './panel';
import adaptiveBorder from './adaptive-border';
import adaptiveBg from './adaptive-bg';
import container from './container';
export default function(app: App) {
for (const [key, value] of Object.entries(directives)) {
......@@ -32,5 +31,4 @@ export const directives = {
'panel': panel,
'adaptive-border': adaptiveBorder,
'adaptive-bg': adaptiveBg,
'container': container,
};
......@@ -206,7 +206,7 @@ definePageMetadata(computed(() => channel ? {
<style lang="scss" module>
.main {
min-height: calc(var(--containerHeight) - (var(--stickyTop, 0px) + var(--stickyBottom, 0px)));
min-height: calc(100cqh - (var(--stickyTop, 0px) + var(--stickyBottom, 0px)));
}
.footer {
......
......@@ -131,7 +131,7 @@ definePageMetadata(computed(() => list ? {
<style lang="scss" module>
.main {
min-height: calc(var(--containerHeight) - (var(--stickyTop, 0px) + var(--stickyBottom, 0px)));
min-height: calc(100cqh - (var(--stickyTop, 0px) + var(--stickyBottom, 0px)));
}
.userItem {
......
......@@ -22,7 +22,7 @@
<span :class="$style.title"><slot name="header"></slot></span>
<button v-tooltip="i18n.ts.settings" :class="$style.menu" class="_button" @click.stop="showSettingsMenu"><i class="ti ti-dots"></i></button>
</header>
<div v-show="active" ref="body" v-container :class="$style.body">
<div v-show="active" ref="body" :class="$style.body">
<slot></slot>
</div>
</section>
......@@ -362,7 +362,7 @@ function onDrop(ev) {
overflow-x: clip;
-webkit-overflow-scrolling: touch;
box-sizing: border-box;
container-type: inline-size;
container-type: size;
background-color: var(--bg);
}
</style>
......@@ -2,10 +2,10 @@
<div :class="[$style.root, { [$style.withWallpaper]: wallpaper }]">
<XSidebar v-if="!isMobile" :class="$style.sidebar"/>
<MkStickyContainer v-container :class="$style.contents">
<MkStickyContainer :class="$style.contents">
<template #header><XStatusBars :class="$style.statusbars"/></template>
<main style="min-width: 0;" :style="{ background: pageMetadata?.value?.bg }" @contextmenu.stop="onContextmenu">
<div :class="$style.content" style="container-type: inline-size;">
<div :class="$style.content" style="container-type: size;">
<RouterView/>
</div>
<div :class="$style.spacer"></div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment