|  | @@ -8,11 +8,28 @@ import IconMore from '../../images/icon-more.png'
 | 
											
												
													
														|  |  import IconLocation from '../../images/icon-location.png'
 |  |  import IconLocation from '../../images/icon-location.png'
 | 
											
												
													
														|  |  import IconOrder from '../../images/icon-order.png'
 |  |  import IconOrder from '../../images/icon-order.png'
 | 
											
												
													
														|  |  import { Popover } from 'vant'
 |  |  import { Popover } from 'vant'
 | 
											
												
													
														|  | 
 |  | +import { postMessage } from '@/helpers/native-message'
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  export default defineComponent({
 |  |  export default defineComponent({
 | 
											
												
													
														|  |    name: 'TheHomeHeader',
 |  |    name: 'TheHomeHeader',
 | 
											
												
													
														|  |    emits: ['cart', 'more', 'search'],
 |  |    emits: ['cart', 'more', 'search'],
 | 
											
												
													
														|  |    setup(props, { emit }) {
 |  |    setup(props, { emit }) {
 | 
											
												
													
														|  | 
 |  | +    const init = () => {
 | 
											
												
													
														|  | 
 |  | +      // 设置是否显示导航栏 0 显示 1 不显示
 | 
											
												
													
														|  | 
 |  | +      const navBarHeight = ref(sessionStorage.getItem('navHeight'))
 | 
											
												
													
														|  | 
 |  | +      postMessage({ api: 'setBarStatus', content: { status: 0 } })
 | 
											
												
													
														|  | 
 |  | +      if (navBarHeight.value) return
 | 
											
												
													
														|  | 
 |  | +      postMessage({ api: 'getNavHeight' }, res => {
 | 
											
												
													
														|  | 
 |  | +        const { content } = res as any
 | 
											
												
													
														|  | 
 |  | +        const dpi = content.dpi || 2
 | 
											
												
													
														|  | 
 |  | +        if (content.navHeight) {
 | 
											
												
													
														|  | 
 |  | +          const navHeight = content.navHeight / dpi + ''
 | 
											
												
													
														|  | 
 |  | +          sessionStorage.setItem('navHeight', navHeight)
 | 
											
												
													
														|  | 
 |  | +          navBarHeight.value = navHeight
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +      })
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    init()
 | 
											
												
													
														|  |      const popoverSlots = {
 |  |      const popoverSlots = {
 | 
											
												
													
														|  |        reference: () => (
 |  |        reference: () => (
 | 
											
												
													
														|  |          <img class={styles.more} src={IconMore} onClick={() => emit('more')} />
 |  |          <img class={styles.more} src={IconMore} onClick={() => emit('more')} />
 | 
											
										
											
												
													
														|  | @@ -26,6 +43,7 @@ export default defineComponent({
 | 
											
												
													
														|  |      ]
 |  |      ]
 | 
											
												
													
														|  |      return () => (
 |  |      return () => (
 | 
											
												
													
														|  |        <div class={styles.theHomeHeader}>
 |  |        <div class={styles.theHomeHeader}>
 | 
											
												
													
														|  | 
 |  | +        <div style={{ height: 'calc(var(--van-nav-bar-height))' }}></div>
 | 
											
												
													
														|  |          <div class={styles.content}>
 |  |          <div class={styles.content}>
 | 
											
												
													
														|  |            <img class={styles.mall} src={IconMall} />
 |  |            <img class={styles.mall} src={IconMall} />
 | 
											
												
													
														|  |            <div class={styles.searchBox} onClick={() => emit('search')}>
 |  |            <div class={styles.searchBox} onClick={() => emit('search')}>
 | 
											
										
											
												
													
														|  | @@ -43,7 +61,7 @@ export default defineComponent({
 | 
											
												
													
														|  |              v-model:show={popoverShow.value}
 |  |              v-model:show={popoverShow.value}
 | 
											
												
													
														|  |              v-slots={popoverSlots}
 |  |              v-slots={popoverSlots}
 | 
											
												
													
														|  |              actions={actions}
 |  |              actions={actions}
 | 
											
												
													
														|  | -            onSelect={(action) => emit('more', action)}
 |  | 
 | 
											
												
													
														|  | 
 |  | +            onSelect={action => emit('more', action)}
 | 
											
												
													
														|  |            ></Popover>
 |  |            ></Popover>
 | 
											
												
													
														|  |          </div>
 |  |          </div>
 | 
											
												
													
														|  |        </div>
 |  |        </div>
 |