NavBar.vue 2.1 KB
<template>
  <view class="navbar">
    <u-navbar :title="props.title" :safeAreaInsetTop="true" :bgColor="isShowBgColor ? '#deeefd' : 'transparent'" :placeholder="true">
      <template #left>
        <view v-if="props.isShowLeft">
          <image src="/static/images/setting.png" class="navbar-icon" mode="aspectFill" @click="proxy.$h.jumpUrl(`/pages/mine/setting`)" />
        </view>
        <view v-else></view>
      </template>
      <template #right>
        <view v-if="props.isShowRight" class="flexA">
          <view class="pobox">
            <image src="/static/images/xin.png" class="navbar-icon" mode="aspectFill" @click="proxy.$h.jumpUrl(`/pages2/message/index`)" />
            <view class="dot" v-if="props.showDot"></view>
          </view>
          <image
            v-if="props.isShowQrCode"
            src="/static/images/mineqr.png"
            class="navbar-icon"
            mode="aspectFill"
            style="margin-right: 0"
            @click=";[20, '20'].includes(props.examineState) ? proxy.$h.jumpUrl(`/pages2/mineinfo/qrcode`) : $u.toast('请先完成认证')"
          />
        </view>
        <view v-else></view>
      </template>
    </u-navbar>
  </view>
</template>

<script setup lang="ts">
import { ref, getCurrentInstance, ComponentPublicInstance } from 'vue'

const { proxy } = getCurrentInstance() as { proxy: ComponentPublicInstance }

interface IProps {
  isShowQrCode?: boolean
  isShowLeft?: boolean
  isShowRight?: boolean
  title: string
  isShowBgColor: boolean
  isplaceholder: boolean
  examineState?: string | number
  showDot?: boolean
}

const props = withDefaults(defineProps<IProps>(), {
  isShowQrCode: false,
  isShowLeft: false,
  isShowRight: false,
  title: '',
  isShowBgColor: true,
  isplaceholder: true,
  showDot: false
})
</script>

<style lang="scss" scoped>
.navbar {
  &-icon {
    width: 60rpx;
    height: 60rpx;
    margin-right: 32rpx;
  }
}
.pobox {
  position: relative;
  .dot {
    position: absolute;
    top: 6rpx;
    right: 32rpx;
    width: 12rpx;
    height: 12rpx;
    background-color: red;
    border-radius: 50%;
  }
}
</style>