+
-
@@ -27,10 +26,8 @@ import { onMounted, onUnmounted, provide, inject, Ref, ref, watch, shallowRef }
import { CURRENT_STICKY_BOTTOM, CURRENT_STICKY_TOP } from '@@/js/const.js';
-const rootEl = shallowRef
();
const headerEl = shallowRef();
const footerEl = shallowRef();
-const bodyEl = shallowRef();
const headerHeight = ref();
const childStickyTop = ref(0);
@@ -67,31 +64,11 @@ onMounted(() => {
watch([parentStickyTop, parentStickyBottom], calc);
- watch(childStickyTop, () => {
- if (bodyEl.value == null) return;
- bodyEl.value.style.setProperty('--MI-stickyTop', `${childStickyTop.value}px`);
- }, {
- immediate: true,
- });
-
- watch(childStickyBottom, () => {
- if (bodyEl.value == null) return;
- bodyEl.value.style.setProperty('--MI-stickyBottom', `${childStickyBottom.value}px`);
- }, {
- immediate: true,
- });
-
if (headerEl.value != null) {
- headerEl.value.style.position = 'sticky';
- headerEl.value.style.top = 'var(--MI-stickyTop, 0)';
- headerEl.value.style.zIndex = '1';
observer.observe(headerEl.value);
}
if (footerEl.value != null) {
- footerEl.value.style.position = 'sticky';
- footerEl.value.style.bottom = 'var(--MI-stickyBottom, 0)';
- footerEl.value.style.zIndex = '1';
observer.observe(footerEl.value);
}
});
@@ -99,8 +76,25 @@ onMounted(() => {
onUnmounted(() => {
observer.disconnect();
});
-
-defineExpose({
- rootEl: rootEl,
-});
+
+