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.

CustomHeader.vue 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <div class="custom-header" :style="{'background-color':backgroundColors}">
  3. <image v-show="back" @click="goBack()" class="header-left" src="../static/image/icon-back.png">
  4. </image>
  5. <div :style="back?'margin-right: 30px;':''" class="header-title">
  6. {{ title }}
  7. </div>
  8. <div class="header-right">
  9. </div>
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. props: {
  15. title: {
  16. type: String,
  17. default: '',
  18. },
  19. back: {
  20. type: Boolean,
  21. default: true,
  22. },
  23. backgroundColors: {
  24. type: String,
  25. default: '#FFF',
  26. },
  27. },
  28. // 其他配置和逻辑
  29. methods: {
  30. goBack() {
  31. window.history.back(); // 返回上一级页面
  32. },
  33. },
  34. }
  35. </script>
  36. <style scoped>
  37. .custom-header {
  38. background: #FFFFFF;
  39. display: flex;
  40. flex-direction: row;
  41. justify-content: space-between;
  42. align-items: center;
  43. z-index: 999;
  44. height: 45px;
  45. }
  46. .header-left {
  47. width: 35px;
  48. height: 35px;
  49. }
  50. .header-title {
  51. text-align: center;
  52. width: 100%;
  53. font-size: 32rpx;
  54. font-weight: bold;
  55. position: relative;
  56. }
  57. /* 其他样式 */
  58. </style>