1
0

NavBarPage.vue 887 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <script setup>
  2. import { ref, reactive, toRefs, onMounted} from 'vue'
  3. const onClickLeft = () => {
  4. if(props.type=='other'){
  5. history.back();
  6. }else{
  7. window.location.href = '/';
  8. }
  9. }
  10. const props = defineProps({
  11. title: {
  12. type: String,
  13. default: '标题'
  14. },
  15. type:{
  16. type: String,
  17. default:'other'
  18. }
  19. })
  20. </script>
  21. <template>
  22. <div>
  23. <van-nav-bar :title="title" left-arrow @click-left="onClickLeft" class="custom-navbar" />
  24. </div>
  25. </template>
  26. <style scoped>
  27. /* 自定义导航栏样式 */
  28. .custom-navbar {
  29. background-color: #fff;
  30. color: black;
  31. position: fixed;
  32. top: 0;
  33. left: 0;
  34. width: 100%;
  35. z-index: 999;
  36. }
  37. /* 更改左侧箭头颜色 */
  38. .custom-navbar :deep(.van-nav-bar__arrow) {
  39. color: black;
  40. }
  41. .custom-navbar::before,
  42. .custom-navbar::after {
  43. display: none !important;
  44. /* 直接隐藏伪元素 */
  45. }
  46. </style>