兼兼街公众号代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.3 KiB

  1. <template>
  2. <view class="comm-navbar position-fixed top-0 w-100 left-0" :style="{background: backgroundColor, zIndex: zIndex}">
  3. <!-- 状态栏 -->
  4. <view class="statusBarHeight"></view>
  5. <view class="navbar flex justify-center align-center">
  6. <view class="nav-icon">
  7. <slot></slot>
  8. <u-icon size="40" v-if="back" class="bakc" :style="{color: textColor}" @click="handleBack" name="arrow-left"></u-icon>
  9. </view>
  10. <view class="nav-text" :style="{color: textColor}">{{ text }}</view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. props: {
  17. text: {
  18. type: String
  19. },
  20. textColor: {
  21. type: String,
  22. default: '#333'
  23. },
  24. backgroundColor: {
  25. type: String,
  26. default: 'transparent'
  27. },
  28. back: {
  29. type: Boolean,
  30. default: false
  31. },
  32. backNum: {
  33. type: Number,
  34. default: 1
  35. },
  36. zIndex: {
  37. type: [Number, String],
  38. default: 999
  39. }
  40. },
  41. methods: {
  42. handleBack () {
  43. uni.navigateBack({
  44. delta: this.backNum
  45. })
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. .comm-navbar {z-index: 999;
  52. .statusBarHeight {width: 100%;height: var(--status-bar-height);}
  53. .navbar {height: 80rpx;width: 100%;padding: 0 32rpx;}
  54. .nav-text {font-size: 36rpx;}
  55. .nav-icon {position: absolute;left: 10rpx;}
  56. .bakc {font-size: 36rpx}
  57. }
  58. </style>