PageHeader.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <div class="page-header">
  3. <div class="page-header-index-wide">
  4. <s-breadcrumb />
  5. <div class="detail">
  6. <div class="main" v-if="!$route.meta.hiddenHeaderContent">
  7. <!-- <div class="row">
  8. <img v-if="logo" :src="logo" class="logo"/>
  9. <h1 v-if="title" class="title">{{ title }}</h1>
  10. <div class="action">
  11. <slot name="action"></slot>
  12. </div>
  13. </div> -->
  14. <div class="row">
  15. <div v-if="avatar" class="avatar">
  16. <a-avatar :src="avatar" />
  17. </div>
  18. <div v-if="this.$slots.content" class="headerContent">
  19. <slot name="content"></slot>
  20. </div>
  21. <div v-if="this.$slots.extra" class="extra">
  22. <slot name="extra"></slot>
  23. </div>
  24. </div>
  25. <div>
  26. <slot name="pageMenu"></slot>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. import Breadcrumb from '@/components/tools/Breadcrumb'
  35. export default {
  36. name: 'PageHeader',
  37. components: {
  38. 's-breadcrumb': Breadcrumb
  39. },
  40. props: {
  41. title: {
  42. type: [String, Boolean],
  43. default: true,
  44. required: false
  45. },
  46. logo: {
  47. type: String,
  48. default: '',
  49. required: false
  50. },
  51. avatar: {
  52. type: String,
  53. default: '',
  54. required: false
  55. }
  56. },
  57. data () {
  58. return {}
  59. }
  60. }
  61. </script>
  62. <style lang="less" scoped>
  63. .page-header {
  64. background: #fff;
  65. padding: 16px 32px 0;
  66. border-bottom: 1px solid #e8e8e8;
  67. .breadcrumb {
  68. margin-bottom: 16px;
  69. }
  70. .detail {
  71. display: flex;
  72. /*margin-bottom: 16px;*/
  73. .avatar {
  74. flex: 0 1 72px;
  75. margin: 0 24px 8px 0;
  76. & > span {
  77. border-radius: 72px;
  78. display: block;
  79. width: 72px;
  80. height: 72px;
  81. }
  82. }
  83. .main {
  84. width: 100%;
  85. flex: 0 1 auto;
  86. .row {
  87. display: flex;
  88. width: 100%;
  89. .avatar {
  90. margin-bottom: 16px;
  91. }
  92. }
  93. .title {
  94. font-size: 20px;
  95. font-weight: 500;
  96. font-size: 20px;
  97. line-height: 28px;
  98. font-weight: 500;
  99. color: rgba(0, 0, 0, 0.85);
  100. margin-bottom: 16px;
  101. flex: auto;
  102. }
  103. .logo {
  104. width: 28px;
  105. height: 28px;
  106. border-radius: 4px;
  107. margin-right: 16px;
  108. }
  109. .content,
  110. .headerContent {
  111. flex: auto;
  112. color: rgba(0, 0, 0, 0.45);
  113. line-height: 22px;
  114. .link {
  115. margin-top: 16px;
  116. line-height: 24px;
  117. a {
  118. font-size: 14px;
  119. margin-right: 32px;
  120. }
  121. }
  122. }
  123. .extra {
  124. flex: 0 1 auto;
  125. margin-left: 88px;
  126. min-width: 242px;
  127. text-align: right;
  128. }
  129. .action {
  130. margin-left: 56px;
  131. min-width: 266px;
  132. flex: 0 1 auto;
  133. text-align: right;
  134. &:empty {
  135. display: none;
  136. }
  137. }
  138. }
  139. }
  140. }
  141. .mobile .page-header {
  142. .main {
  143. .row {
  144. flex-wrap: wrap;
  145. .avatar {
  146. flex: 0 1 25%;
  147. margin: 0 2% 8px 0;
  148. }
  149. .content,
  150. .headerContent {
  151. flex: 0 1 70%;
  152. .link {
  153. margin-top: 16px;
  154. line-height: 24px;
  155. a {
  156. font-size: 14px;
  157. margin-right: 10px;
  158. }
  159. }
  160. }
  161. .extra {
  162. flex: 1 1 auto;
  163. margin-left: 0;
  164. min-width: 0;
  165. text-align: right;
  166. }
  167. .action {
  168. margin-left: unset;
  169. min-width: 266px;
  170. flex: 0 1 auto;
  171. text-align: left;
  172. margin-bottom: 12px;
  173. &:empty {
  174. display: none;
  175. }
  176. }
  177. }
  178. }
  179. }
  180. </style>