PageLayout.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div :style="!$route.meta.pageHeader ? 'margin: -24px -24px 0px;' : null">
  3. <!-- pageHeader , route meta hideHeader:true on hide -->
  4. <page-header v-if="!$route.meta.pageHeader" :title="title" :logo="logo" :avatar="avatar">
  5. <slot slot="action" name="action"></slot>
  6. <slot slot="content" name="headerContent"></slot>
  7. <div slot="content" v-if="!this.$slots.headerContent && desc">
  8. <p style="font-size: 14px;color: rgba(0,0,0,.65)">{{ desc }}</p>
  9. <div class="link">
  10. <template v-for="(link, index) in linkList">
  11. <a :key="index" :href="link.href">
  12. <a-icon :type="link.icon"/>
  13. <span>{{ link.title }}</span>
  14. </a>
  15. </template>
  16. </div>
  17. </div>
  18. <slot slot="extra" name="extra"></slot>
  19. <div slot="pageMenu">
  20. <div class="page-menu-search" v-if="search">
  21. <a-input-search style="width: 80%; max-width: 522px;" placeholder="请输入..." size="large" enterButton="搜索" />
  22. </div>
  23. <div class="page-menu-tabs" v-if="tabs && tabs.items">
  24. <!-- @change="callback" :activeKey="activeKey" -->
  25. <a-tabs :tabBarStyle="{margin: 0}" @change="tabs.callback" :activeKey="tabs.active()">
  26. <a-tab-pane v-for="item in tabs.items" :tab="item.title" :key="item.key"></a-tab-pane>
  27. </a-tabs>
  28. </div>
  29. </div>
  30. </page-header>
  31. <div class="content">
  32. <div :class="['page-header-index-wide']">
  33. <slot></slot>
  34. </div>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import PageHeader from './PageHeader'
  40. export default {
  41. name: "LayoutContent",
  42. components: {
  43. PageHeader
  44. },
  45. // ['desc', 'logo', 'title', 'avatar', 'linkList', 'extraImage']
  46. props: {
  47. desc: {
  48. type: String,
  49. default: null
  50. },
  51. logo: {
  52. type: String,
  53. default: null
  54. },
  55. title: {
  56. type: String,
  57. default: null
  58. },
  59. avatar: {
  60. type: String,
  61. default: null
  62. },
  63. linkList: {
  64. type: Array,
  65. default: null
  66. },
  67. extraImage: {
  68. type: String,
  69. default: null
  70. },
  71. search: {
  72. type: Boolean,
  73. default: false
  74. },
  75. tabs: {
  76. type: Object,
  77. default: () => {}
  78. }
  79. },
  80. methods: {
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .content {
  86. margin: 24px 24px 0;
  87. .link {
  88. margin-top: 16px;
  89. &:not(:empty) {
  90. margin-bottom: 16px;
  91. }
  92. a {
  93. margin-right: 32px;
  94. height: 24px;
  95. line-height: 24px;
  96. display: inline-block;
  97. i {
  98. font-size: 24px;
  99. margin-right: 8px;
  100. vertical-align: middle;
  101. }
  102. span {
  103. height: 24px;
  104. line-height: 24px;
  105. display: inline-block;
  106. vertical-align: middle;
  107. }
  108. }
  109. }
  110. }
  111. .page-menu-search {
  112. text-align: center;
  113. margin-bottom: 16px;
  114. }
  115. .page-menu-tabs {
  116. margin-top: 48px;
  117. }
  118. </style>