index.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <script setup>
  2. import { computed } from 'vue'
  3. import { ArrowLeftBold } from '@element-plus/icons-vue'
  4. const props = defineProps({
  5. modelValue: Boolean,
  6. title: String,
  7. closeTitle: String,
  8. tabs: Array,
  9. tabsDefalut: [String, Number]
  10. })
  11. const emit = defineEmits(['update:modelValue', 'update:tabsDefalut'])
  12. const show = computed({
  13. get() {
  14. return props.modelValue
  15. },
  16. set(value) {
  17. emit('update:modelValue', value)
  18. }
  19. })
  20. const tabsVal = computed({
  21. get() {
  22. return props.tabsDefalut
  23. },
  24. set(value) {
  25. emit('update:tabsDefalut', value)
  26. }
  27. })
  28. const close = () => {
  29. show.value = false
  30. }
  31. const tabClick = () => { }
  32. </script>
  33. <template>
  34. <div class="full-dialog-container" v-show="show">
  35. <div class="dia-header">
  36. <div class="dia-title" v-if="title && !tabs">{{ title }}</div>
  37. <el-tabs v-if="tabs" v-model="tabsVal" @tab-click="tabClick">
  38. <el-tab-pane v-for="(item, index) in tabs" :key="index" :label="item.label" :name="item.name"></el-tab-pane>
  39. </el-tabs>
  40. <el-button plain type="primary" @click="close">
  41. <el-icon><ArrowLeftBold /></el-icon> <span>{{ closeTitle || '返回' }}</span> </el-button>
  42. </div>
  43. <div class="dia-content">
  44. <slot></slot>
  45. </div>
  46. </div>
  47. </template>
  48. <style lang="scss" scoped>
  49. .full-dialog-container {
  50. position: absolute;
  51. left: 0;
  52. top: 0;
  53. right: 0;
  54. bottom: 0;
  55. background: #fff;
  56. z-index: 900;
  57. border-radius: 10px;
  58. :deep(.el-tabs) {
  59. margin: 0;
  60. }
  61. :deep(.el-tabs__header) {
  62. margin: 0;
  63. }
  64. :deep(.el-tabs__nav-wrap::after) {
  65. height: 0;
  66. }
  67. .dia-header {
  68. position: absolute;
  69. top: 0;
  70. width: 100%;
  71. z-index: 10;
  72. height: 60px;
  73. border-bottom: 1px solid #eee;
  74. padding: 20px;
  75. display: flex;
  76. justify-content: space-between;
  77. align-items: center;
  78. .dia-title {
  79. font-size: 16px;
  80. font-weight: bold;
  81. }
  82. }
  83. .dia-content {
  84. height: calc(100% - 60px);
  85. margin-top: 60px;
  86. overflow: auto;
  87. padding: 20px;
  88. }
  89. }
  90. </style>