|
@@ -1,4 +1,4 @@
|
|
|
-import { defineComponent, ref } from 'vue'
|
|
|
+import { defineComponent, nextTick, onMounted, ref } from 'vue'
|
|
|
import styles from './index.module.less'
|
|
|
|
|
|
import IconMall from '../../images/icon-mall.png'
|
|
@@ -10,12 +10,14 @@ import IconOrder from '../../images/icon-order.png'
|
|
|
import { Badge, Popover } from 'vant'
|
|
|
import { postMessage } from '@/helpers/native-message'
|
|
|
import { cartCount } from '../../shop-mall'
|
|
|
+import { useRect } from '@vant/use'
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'TheHomeHeader',
|
|
|
- emits: ['cart', 'more', 'search'],
|
|
|
+ emits: ['cart', 'more', 'search', 'headerDom'],
|
|
|
setup(props, { emit }) {
|
|
|
const navBarHeight = ref(sessionStorage.getItem('navHeight'))
|
|
|
+ const homeHeaderDom = ref(null)
|
|
|
const init = () => {
|
|
|
// 设置是否显示导航栏 0 显示 1 不显示
|
|
|
postMessage({ api: 'setBarStatus', content: { status: 0 } })
|
|
@@ -37,13 +39,20 @@ export default defineComponent({
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+ onMounted(() => {
|
|
|
+ nextTick(() => {
|
|
|
+ const { height } = useRect(homeHeaderDom as any)
|
|
|
+ emit('headerDom', height)
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
const popoverShow = ref(false)
|
|
|
const actions = [
|
|
|
{ text: '我的订单', icon: IconOrder, url: '/goodsOrder' },
|
|
|
{ text: '我的地址', icon: IconLocation, url: '/' }
|
|
|
]
|
|
|
return () => (
|
|
|
- <div class={styles.theHomeHeader}>
|
|
|
+ <div class={styles.theHomeHeader} ref={homeHeaderDom}>
|
|
|
<div
|
|
|
style={{ height: navBarHeight.value + 'px', background: '#fff' }}
|
|
|
></div>
|