skyblued 2 years ago
parent
commit
04495a0a6b
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/views/shop-mall/components/TheHomeHeader/index.tsx

+ 2 - 2
src/views/shop-mall/components/TheHomeHeader/index.tsx

@@ -14,9 +14,9 @@ export default defineComponent({
   name: 'TheHomeHeader',
   emits: ['cart', 'more', 'search'],
   setup(props, { emit }) {
+    const navBarHeight = ref(sessionStorage.getItem('navHeight'))
     const init = () => {
       // 设置是否显示导航栏 0 显示 1 不显示
-      const navBarHeight = ref(sessionStorage.getItem('navHeight'))
       postMessage({ api: 'setBarStatus', content: { status: 0 } })
       if (navBarHeight.value) return
       postMessage({ api: 'getNavHeight' }, res => {
@@ -43,7 +43,7 @@ export default defineComponent({
     ]
     return () => (
       <div class={styles.theHomeHeader}>
-        <div style={{ height: 'calc(var(--van-nav-bar-height))' }}></div>
+        <div style={{ height: navBarHeight.value + 'px' }}></div>
         <div class={styles.content}>
           <img class={styles.mall} src={IconMall} />
           <div class={styles.searchBox} onClick={() => emit('search')}>