|
@@ -1,4 +1,11 @@
|
|
|
-import { defineComponent, onMounted, reactive, ref } from 'vue';
|
|
|
+import {
|
|
|
+ defineComponent,
|
|
|
+ watch,
|
|
|
+ reactive,
|
|
|
+ ref,
|
|
|
+ onMounted,
|
|
|
+ nextTick
|
|
|
+} from 'vue';
|
|
|
import styles from './index.module.less';
|
|
|
import MHeader from '@/components/m-header';
|
|
|
import MFooter from '@/components/m-footer';
|
|
@@ -10,20 +17,51 @@ import PianoRoom from './piano-room';
|
|
|
import MusicRoom from './music-room';
|
|
|
import CoTenant from './co-tenant';
|
|
|
import CoPerson from './co-person';
|
|
|
-import { useScroll } from '@vueuse/core';
|
|
|
+// import { useResizeObserver, useWindowScroll } from '@vueuse/core';
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'home-page',
|
|
|
setup() {
|
|
|
const state = reactive({
|
|
|
activeTab: 1,
|
|
|
- banner: aiBanner
|
|
|
+ banner: aiBanner,
|
|
|
+ headerHeight: 0
|
|
|
});
|
|
|
- const homeRef = ref<HTMLElement | null>(null);
|
|
|
- // const { x, y, isScrolling, arrivedState, directions } = useScroll(homeRef);
|
|
|
+ // const headerRef = ref<HTMLElement | null>(null);
|
|
|
+ // const tabRef = ref<HTMLElement | null>(null);
|
|
|
+ // const { x, y } = useWindowScroll();
|
|
|
|
|
|
+ // onMounted(() => {
|
|
|
+ // nextTick(() => {
|
|
|
+ // try {
|
|
|
+ // useResizeObserver(headerRef.value, (entries: any) => {
|
|
|
+ // const entry = entries[0];
|
|
|
+ // const { height } = entry.contentRect;
|
|
|
+ // state.headerHeight = height;
|
|
|
+ // });
|
|
|
+ // } catch {
|
|
|
+ // //
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ // watch(
|
|
|
+ // () => y.value,
|
|
|
+ // () => {
|
|
|
+ // console.log(y.value, state.headerHeight);
|
|
|
+ // if (state.headerHeight > 0 && y.value >= state.headerHeight) {
|
|
|
+ // console.log(document.querySelector('.van-sticky'));
|
|
|
+ // document
|
|
|
+ // .querySelector('.van-sticky')
|
|
|
+ // ?.classList.add('van-sticky--fixed');
|
|
|
+ // } else {
|
|
|
+ // document
|
|
|
+ // .querySelector('.van-sticky')
|
|
|
+ // ?.classList.remove('van-sticky--fixed');
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // );
|
|
|
return () => (
|
|
|
- <div class={styles.home} ref={homeRef}>
|
|
|
+ <div class={styles.home}>
|
|
|
<MHeader />
|
|
|
|
|
|
<div class={styles.banner}>
|