index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div class="page-layout-info manager-page-padding" v-loading="loading" :class="{'page-layout-info--border': border}" :style="{ width }">
  3. <div class="page-layout-info__header" v-if="!cHideHeader">
  4. <div >
  5. <slot name="back">
  6. <el-button type="text" @click="backPrePage" icon="el-icon-arrow-left">返回</el-button>
  7. </slot>
  8. <span class="page-layout-info__title" v-if="title">
  9. {{title}}
  10. </span>
  11. </div>
  12. <div>
  13. <slot name="handle"></slot>
  14. </div>
  15. </div>
  16. <div class="page-layout-info__main">
  17. <slot></slot>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. import { inject, computed } from 'vue'
  23. import { useRouter } from 'vue-router'
  24. import { ElButton, ElLoading } from 'element-plus'
  25. export default {
  26. name: 'PageLayoutInfo',
  27. components: { ElButton },
  28. props: {
  29. border: { // handle-bar 是否有边框
  30. type: Boolean,
  31. default: true
  32. },
  33. title: { // 页面title
  34. type: String
  35. },
  36. width: {
  37. type: String, // eg: 1px
  38. default: '100%'
  39. },
  40. loading: Boolean,
  41. hideHeader: {}
  42. },
  43. directives: {
  44. loading: ElLoading.directive
  45. },
  46. setup (props) {
  47. const cipConfig = inject('cip-config', {})
  48. const cHideHeader = computed(() => {
  49. if (props.hideHeader !== undefined) {
  50. return props.hideHeader
  51. } else {
  52. return cipConfig.layout.hideHeader === true
  53. }
  54. })
  55. const router = useRouter()
  56. const backPrePage = () => {
  57. // TODO: 可进一步处理
  58. router.go(-1)
  59. }
  60. return {
  61. cHideHeader,
  62. backPrePage
  63. }
  64. }
  65. }
  66. </script>
  67. <style lang="less">
  68. .page-layout-info{
  69. //&::-webkit-scrollbar { width: 0 !important }
  70. box-sizing: border-box;
  71. margin: 0 auto;
  72. &.page-layout-info--border{
  73. .page-layout-info__header{
  74. box-sizing: border-box;
  75. border: 1px solid #ddd;
  76. }
  77. }
  78. height: 100%;
  79. @handleBarHeight: 40px;
  80. background: @background;
  81. &__header{
  82. height: @handleBarHeight;
  83. background: #fff;
  84. margin-bottom: 8px;
  85. padding: 0 12px;
  86. display: flex;
  87. justify-content: space-between;
  88. align-items: center;
  89. }
  90. &__title{
  91. font-weight: bold;
  92. &:before{
  93. content: " ";
  94. margin: 8px;
  95. border-left: 2px solid #bbb;
  96. line-height: 0.8em;
  97. }
  98. }
  99. &__main{
  100. height: calc(100% - @handleBarHeight - 8px);
  101. }
  102. }
  103. </style>