<template><page-meta :root-font-size="fontSize+'px'"></page-meta>
    <home-base :show="true" >
        <view style="position: absolute;top:0;right:0;left:0;bottom:0" class="scroll-view-wrapper div container" v-if="navHeight == 0">
            <home-common-search :value="params.keyword"></home-common-search>
            <view class="scroll-view div" style="position:relative;"><goodslist-body></goodslist-body></view>
        </view>
        <view :style="'position: absolute;top:0;right:0;left:0;bottom:0;padding-top:'+navHeight+'px'" class="scroll-view-wrapper div container" v-else>
            <home-common-search :value="params.keyword"></home-common-search>
            <view class="scroll-view div" style="position:relative;"><goodslist-body></goodslist-body></view>
        </view>
    </home-base>
</template>

<script>
import {getFontSize} from '@/util/common'
import HomeBase from '../HomeBase'
import HomeCommonSearch from '../common/HomeCommonSearch'
import GoodslistBody from './GoodslistBody'
export default {
  name:'HomeGoodslist',
  components:{
    HomeBase,
    HomeCommonSearch,
    GoodslistBody
  },
  computed:{
  fontSize(){
    return getFontSize()
  },
  },
  data(){
    return {
      params: {
        keyword: ''
      },
      navHeight:0

    }
  },
  onLoad: function (option) {
    this.keyword=option.keywords ? option.keywords : ''
  },
  mounted: function() {
    // #ifdef  MP-WEIXIN
    this.navHeight = uni.getMenuButtonBoundingClientRect().top
    // #endif
    // #ifdef APP-PLUS
      this.navHeight = 40
    // #endif
  },
}
</script>

<style scoped lang="scss">
  .scroll-view-wrapper{display: flex;flex-direction: column;}
  .scroll-view{flex:1}

</style>
