custom-nav.vue 856 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <view class="custom-nav" :style="{ borderTopColor: statusBarColor, backgrounf: bgColor }">
  3. <text class="back cuIcon-back" @tap="back"></text>
  4. <text class="title">{{ title }}</text>
  5. </view>
  6. </template>
  7. <script>
  8. //自定义导航栏组件
  9. export default {
  10. props: {
  11. title: String,
  12. statusBarColor: String,
  13. bgColor: String
  14. },
  15. methods: {
  16. back () {
  17. uni.navigateBack()
  18. }
  19. }
  20. }
  21. </script>
  22. <style lang="scss" scoped>
  23. .custom-nav {
  24. position: fixed;
  25. z-index: 2;
  26. top: 0;
  27. width: 100%;
  28. height: $custom-nav-height;
  29. box-sizing: border-box;
  30. border-top: 34rpx solid #FFFFFF;
  31. padding-left: 30rpx;
  32. display: flex;
  33. align-items: center;
  34. font-size: 40rpx;
  35. line-height: 40rpx;
  36. color: #2A2A2A;
  37. background: #FFFFFF;
  38. .back {
  39. font-size: 42rpx;
  40. line-height: 42rpx;
  41. margin-right: 8rpx;
  42. }
  43. }
  44. </style>