<template>
  <van-sticky>
    <van-nav-bar>
      <template #left>
        <van-icon
          name="arrow-left"
          size="18"
          @click="onClickLeft"
          v-show="props.showtype == 'home' ? false : true"
        />
      </template>
      <template #title>
        <van-cell :title="toptitle"></van-cell>
      </template>
      <template #right>
        <van-icon
          v-if="showtype == 'yinhuan-dengji'"
          class-prefix="my-icon"
          name="zengjia"
          size="24"
          color="var(--van-nav-bar-icon-color)"
          @click="toXinzeng()"
        />
      </template>
    </van-nav-bar>
  </van-sticky>
</template>

<script setup>
import { computed, reactive } from "vue";
import { useRouter } from "vue-router";

name: "yinhuantopbar";
const props = defineProps({
  showtype: String,
});
const emit = defineEmits(["commitSelect", "cancelSelect"]);

const router = useRouter();
let toptitle = computed(() => {
  if (props.showtype == "yinhuan") {
    return "隐患排查与治理";
  }
  if (props.showtype == "yinhuan-dengji") {
    return "隐患登记";
  }
  if (props.showtype == "yinhuan-dengji-detail") {
    return "隐患登记详情";
  }
  if (props.showtype == "unknow") {
    return "模块建设中";
  }
});
const onClickLeft = () => {
  history.back();
};
const toXinzeng = () => {
  router.push({
    path: "/yinhuan-dengji-detail",
    query: { id: "", flowId: "071", applyStatus: "7101" },
  });
};
</script>
<style scoped>
.van-nav-bar__title .van-cell {
  color: var(--van-gray-9); /* color: var(--van-primary-color); */
  font-size: var(--van-font-size-lg1);
}
</style>
