index.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <ContentBox
  3. class="go-content-layers go-boderbox"
  4. :class="{ scoped: !chartLayoutStore.getDetails }"
  5. :showTop="false"
  6. >
  7. <n-tabs class="tabs-box" size="small" type="segment">
  8. <n-tab-pane
  9. v-for="item in tabList"
  10. :key="item.key"
  11. :name="item.key"
  12. display-directive="show:lazy"
  13. >
  14. <template #tab>
  15. <n-space>
  16. <span>{{ item.title }}</span>
  17. <n-icon size="16" class="icon-position">
  18. <component :is="item.icon"></component>
  19. </n-icon>
  20. </n-space>
  21. </template>
  22. <component :is="item.render"></component>
  23. </n-tab-pane>
  24. </n-tabs>
  25. </ContentBox>
  26. </template>
  27. <script setup lang="ts">
  28. import { reactive } from 'vue'
  29. import { renderIcon } from '@/utils'
  30. import { icon } from '@/plugins'
  31. import { ContentBox } from '../ContentBox/index'
  32. import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
  33. import { Setting } from './components/Setting/index'
  34. import { Behind } from './components/Behind/index'
  35. const chartLayoutStore = useChartLayoutStore()
  36. const { CubeIcon, FlashIcon } = icon.ionicons5
  37. const tabList = reactive([
  38. {
  39. key: 'setting',
  40. title: '配置项',
  41. icon: renderIcon(CubeIcon),
  42. render: Setting
  43. },
  44. {
  45. key: 'behind',
  46. title: '后端数据',
  47. icon: renderIcon(FlashIcon),
  48. render: Behind
  49. }
  50. ])
  51. </script>
  52. <style lang="scss" scoped>
  53. $wight: 400px;
  54. @include go(content-layers) {
  55. width: $wight;
  56. padding: 10px;
  57. overflow: hidden;
  58. @extend .go-transition;
  59. .icon-position {
  60. padding-top: 2px;
  61. }
  62. &.scoped {
  63. width: 0;
  64. padding: 0;
  65. }
  66. .tabs-box {
  67. /* padding 值 */
  68. width: $wight - 2 * 10;
  69. }
  70. }
  71. </style>