<template>
  <view
    class="top-nav"
    :class="[isFixed ? 'pf' : 'p-relative']"
    :style="{
      backgroundColor: backgroundColor,
    }"
  >
    <!-- 顶部 -->
    <view class="nav" :style="{ height: navHeight + 'px' }">
      <view
        :style="{
          paddingTop: statusHeight + 'px',
          color: color,
        }"
        class="title"
      >
        <view class="content">
          <!-- <image
            v-if="iconType == 1"
            class="left-jiantou"
            :src="$metaCommon.static_url('left_back01.png')"
            mode="aspectFill"
            @click="goBack"
          />
          <image
            v-if="iconType == 2"
            class="left-jiantou"
            :src="$metaCommon.static_url('left_back02.png')"
            mode="aspectFill"
            @click="goBack"
          />
          <image
            v-if="iconType == 3"
            class="left-jiantou"
            :src="$metaCommon.static_url('left_back03.png')"
            mode="aspectFill"
            @click="goBack"
          /> -->
          <text  v-if="iconType == 1" class="left-jiantou">1</text>
          <text  v-if="iconType == 2" class="left-jiantou">2</text>
          <text  v-if="iconType == 3" class="left-jiantou">3</text>

        </view>
        <view
          class="font-700 font-size-34rpx"
          :style="{
            lineHeight: titleHeight + 'px',
          }"
        >
          {{ title }}
          <slot></slot>
        </view>
        <view class="right-content">
          <slot name="right"></slot>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
/**
 * shoproEmpty- 数据为空页
 * @property {String} title - 标题
 * @property {String} color - 标题颜色
 * @property {String} iconType - 返回箭头的类型选择 (1==透明 2==黑色)
 * @property {String} delta - 返回的层级
 * @property {Boolean} status - 是否启用自定义事件
 * @property {Boolean} isFixed - 是否启用顶部固定定位
 */

import { sysInfo } from "../../meeting/utils/systeminfo"
export default {
  name: "",
  data() {
    return {
      navHeight: sysInfo.customBarHeight,
      statusHeight: sysInfo.statusBarHeight,
      titleHeight: sysInfo.titleBarHeight,
    };
  },
  props: {
    title: {
      type: String,
      default: "",
    },
    color: {
      type: String,
      default: "",
    },
    iconType: {
      type: [String, Number],
      default: 1,
    },
    delta: {
      type: [Number, String],
      default: 1,
    },
    status: {
      type: Boolean,
      default: true,
    },
    isFixed: {
      type: Boolean,
      default: true,
    },
    backgroundColor: {
      type: String,
      default: "none",
    },
  },
  methods: {
    goBack() {
      if (this.status) {
        uni.navigateBack({
          delta: Number(this.delta),
        });
      } else {
        this.$emit("goBack");
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  position: relative;
}

.left-jiantou {
  position: absolute;
  width: 48rpx;
  height: 48rpx;
  left: 24rpx;
  top: 20rpx;
}

.top-nav {
  width: 100%;
  // position: fixed;
  z-index: 100001;
  box-sizing: border-box;
}

.pf {
  position: fixed;
}

.p-relative {
  position: relative;
}

.title {
  text-align: center;
}
.right-content {
  position: absolute;
  right: 24rpx;
  top: 20rpx;
}
</style>
