index.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <view class="nav-bar" :style="{ paddingTop: 12 + BarHeight + 'px' }">
  3. <view class="go-back">
  4. <u-icon name="arrow-leftward" :color="color" size="32" @click="goBack"></u-icon>
  5. </view>
  6. <view class="nav-title" :style="{color:color}">
  7. {{ title }}
  8. </view>
  9. <view class="go-back">
  10. <slot name="right"></slot>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. data() {
  17. return {
  18. BarHeight:'',
  19. goBack(){
  20. uni.navigateBack()
  21. }
  22. };
  23. },
  24. props: {
  25. title: "",
  26. color:''
  27. },
  28. mounted(){
  29. // #ifdef APP-PLUS
  30. let systemInfo = uni.getSystemInfoSync();
  31. this.BarHeight = systemInfo.statusBarHeight;
  32. // #endif
  33. }
  34. };
  35. </script>
  36. <style lang="scss" scoped>
  37. .nav-bar {
  38. width: 100%;
  39. padding: 24rpx 32rpx 20rpx 32rpx;
  40. box-sizing: border-box;
  41. color: rgba(255, 255, 255, 1);
  42. font-family: DM Sans;
  43. font-size: 30rpx;
  44. font-weight: 700;
  45. line-height: 26px;
  46. display: flex;
  47. // justify-content: center;
  48. align-items: center;
  49. position: relative;
  50. .go-back{
  51. width: 32.61px;
  52. height: 26px;
  53. }
  54. .nav-title{
  55. flex: 1;
  56. text-align: center;
  57. }
  58. }
  59. </style>