InspectorState.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <script setup lang="ts">
  2. import CodeView from '../CodeView.vue'
  3. import InspectorTree from './InspectorTree.vue'
  4. const tabs = [
  5. {
  6. slug: 'inspector-tree',
  7. name: 'Inspector Tree',
  8. component: InspectorTree,
  9. path: '/inspector-tree',
  10. icon: 'i-carbon-tree-view',
  11. },
  12. {
  13. slug: 'code-view',
  14. name: 'Code View',
  15. component: CodeView,
  16. path: '/code-view',
  17. icon: 'i-iconoir-code',
  18. },
  19. ]
  20. const currentTab = ref(0)
  21. const { selectedObject } = useDevtoolsHook()
  22. </script>
  23. <template>
  24. <header class="border-b border-base p4 text-gray-400 flex justify-between">
  25. <div>
  26. {{ selectedObject.type }}
  27. <UBadge
  28. v-if="selectedObject.name "
  29. variant="soft"
  30. >
  31. {{ selectedObject.name }}
  32. </UBadge>
  33. </div>
  34. <div class="flex gap-4">
  35. <UButton
  36. v-for="tab, index in tabs"
  37. :key="tab.name"
  38. :variant="tabs[currentTab].name === tab.name ? 'solid' : 'ghost'"
  39. size="sm"
  40. :icon="tab.icon"
  41. @click="currentTab = index"
  42. />
  43. </div>
  44. </header>
  45. <div class="w-full p4 overflow-y-scroll h-full">
  46. <component :is="tabs[currentTab].component" />
  47. <!-- <template v-if="currentTab.slug === 'property-tree'">
  48. <PropertyTree />
  49. </template>
  50. <template v-else-if="currentTab.slug === 'code-view'">
  51. <CodeView />
  52. </template> -->
  53. </div>
  54. </template>