mirror of
https://example.com
synced 2024-11-23 07:16:38 +09:00
Merge branch 'develop' of codeberg.org:firefish/firefish into develop
This commit is contained in:
commit
5557836f61
1 changed files with 17 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div ref="rootEl">
|
||||
<div class="sticky-container">
|
||||
<div ref="headerEl">
|
||||
<slot name="header"></slot>
|
||||
</div>
|
||||
|
@ -19,7 +19,6 @@ const CURRENT_STICKY_TOP = "CURRENT_STICKY_TOP";
|
|||
import type { Ref } from "vue";
|
||||
import { inject, onMounted, onUnmounted, provide, ref, watch } from "vue";
|
||||
|
||||
const rootEl = $ref<HTMLElement>();
|
||||
const headerEl = $ref<HTMLElement>();
|
||||
const bodyEl = $ref<HTMLElement>();
|
||||
|
||||
|
@ -54,10 +53,6 @@ onMounted(() => {
|
|||
},
|
||||
);
|
||||
|
||||
headerEl.style.position = "sticky";
|
||||
headerEl.style.top = "var(--stickyTop, 0)";
|
||||
headerEl.style.zIndex = "1000";
|
||||
|
||||
observer.observe(headerEl);
|
||||
});
|
||||
|
||||
|
@ -66,4 +61,19 @@ onUnmounted(() => {
|
|||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" module></style>
|
||||
<style lang="scss">
|
||||
.sticky-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
> div:first-child {
|
||||
position: sticky;
|
||||
top: var(--stickyTop, 0);
|
||||
z-index: 1000;
|
||||
}
|
||||
> div:last-child {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-grow: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in a new issue