common-header.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. padding-top: env(safe-area-inset-top);
  35. height: calc(96rpx + env(safe-area-inset-top));
  36. padding-left: 24rpx;
  37. padding-right: 24rpx;
  38. background-color: #FFFFFF;
  39. border-bottom: 2rpx solid #F3F3F3;
  40. .header_left {
  41. width: 48rpx;
  42. }
  43. .header_title {
  44. flex: 1;
  45. text-align: center;
  46. font-weight: 500;
  47. font-size: 32rpx;
  48. color: #333333;
  49. }
  50. .header_right {
  51. width: 48rpx;
  52. }
  53. }
  54. </style>