<style lang="less">
.nwrap {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  box-sizing: border-box;
  z-index: 2;
  // background: rgba(61, 203, 204, 0.2);

  .arrow {
    position: absolute;
    top: 0;
    left: 16px;
  }
  .title {
    font-size: 18px;
    font-weight: 500;
    line-height: 24px;
    text-align: center;
    color: #1b2129;
  }
}
</style>
<template>
  <div class="nwrap" style="height:{{ barHeight }}px;padding-top:{{ barTop }}px;">
    <div class="arrow" style="top:{{ barTop }}px" @click="goBack"><van-icon name="arrow-left" size="20"/></div>
    <div class="title" v-if="ntitle">{{ ntitle?ntitle:'' }}</div>
  </div>

</template>

<script>
import wepy from '@wepy/core';
import store from '@/store';
import config from '@/config';

wepy.component({
  store,
  props: { goto: String },
  data: {
    h5StaticPath: config.h5StaticPath + '/page-home/',
    barTop: 0,
    barHeight: 0,
  },
  ready() {
    debugger;

    // 胶囊按钮位置信息
    const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
    console.log('menuButtonInfo', menuButtonInfo);
    this.barTop = menuButtonInfo.top + 4;
    this.barHeight = menuButtonInfo.top + menuButtonInfo.height;
  },
  detached() {
    debugger;
    console.log('detacheddetached');
  },
  watch: {},
  methods: {
    goBack() {
      console.log('this.gotothis.goto',this.goto);
      if (this.goto == 'home') {
        wx.navigateTo({
        url: `/packagesEnv/pages/home/index`,
      });
      } else {
        wx.navigateBack();
      }
    },
  },
});
</script>
<config>
{
"navigationStyle":"custom",
usingComponents: {
  "van-icon": "module:@vant/weapp/dist/icon",
}
}
</config>
