<template>
  <!-- h5显示导航栏 -->
  <view>
    <u-navbar
      :autoBack="true"
      :title="pageTitle"
      :titleStyle="{ fontSize: '16px', fontWeight: '700' }"
      :leftIcon="leftIcon"
      v-if="isOther"
    >
    </u-navbar>
  </view>
</template>

<script>
export default {
  props: {
    pageTitle: {
      type: String,
      required: "",
    },
    isAuditTitle: {
      type: String,
      required: "",
    },
    leftIcon: {
      type: String,
      required: "arrow-left",
    },
  },
  data() {
    return {
      isOther: false, //H5
      // 判断当前环境是微信、钉钉
      isWeChatOrDingTalk: "",
      // 页面标题
    };
  },
  methods: {
    currentEnvironment() {
      // 检测是否在微信或钉钉环境中打开
      const userAgent = navigator.userAgent.toLowerCase();
      if (userAgent.indexOf("dingtalk") !== -1) {
        //钉钉
        this.$ddFunction.setTitle(this.pageTitle);
        if (this.isAuditTitle == "external") {
          this.$ddFunction.setRight();
        }
        this.isOther = false;
      } else if (userAgent.indexOf("micromessenger") !== -1) {
        //微信
        this.isOther = true
      } else {
        this.isOther = true;
      }
    },
  },
};
</script>

<style>
</style>