common-header.vue 961 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <view class="common_header">
  3. <view class="header_left" @click="handleBack">
  4. <uni-icons type="back" size="24" color="#333333"></uni-icons>
  5. </view>
  6. <text class="header_title">{{ title }}</text>
  7. <view class="header_right">
  8. <slot name="right"></slot>
  9. </view>
  10. </view>
  11. </template>
  12. <script setup>
  13. const props = defineProps({
  14. title: {
  15. type: String,
  16. default: ''
  17. }
  18. });
  19. const emit = defineEmits(['back']);
  20. const handleBack = () => {
  21. emit('back');
  22. };
  23. </script>
  24. <style lang="scss" scoped>
  25. .common_header {
  26. position: fixed;
  27. top: 0;
  28. left: 0;
  29. right: 0;
  30. z-index: 100;
  31. display: flex;
  32. align-items: center;
  33. justify-content: space-between;
  34. height: 96rpx;
  35. padding: 0 24rpx;
  36. background-color: #FFFFFF;
  37. border-bottom: 2rpx solid #F3F3F3;
  38. .header_left {
  39. width: 48rpx;
  40. }
  41. .header_title {
  42. flex: 1;
  43. text-align: center;
  44. font-weight: 500;
  45. font-size: 32rpx;
  46. color: #333333;
  47. }
  48. .header_right {
  49. width: 48rpx;
  50. }
  51. }
  52. </style>