index.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <div @click="clickHandle">
  3. <n-tooltip v-if="collapsed" placement="right" trigger="hover">
  4. <template #trigger>
  5. <n-button ghost type="primary" size="small">
  6. <template #icon>
  7. <n-icon>
  8. <DuplicateOutlineIcon v-show="designStore.getDarkTheme" />
  9. <DuplicateIcon v-show="!designStore.getDarkTheme" />
  10. </n-icon>
  11. </template>
  12. </n-button>
  13. </template>
  14. <span>
  15. 新建
  16. </span>
  17. </n-tooltip>
  18. <n-button v-else ghost type="primary" size="large">
  19. <template #icon>
  20. <n-icon>
  21. <DuplicateOutlineIcon v-show="designStore.getDarkTheme" />
  22. <DuplicateIcon v-show="!designStore.getDarkTheme" />
  23. </n-icon>
  24. </template>
  25. <span>
  26. 新建
  27. </span>
  28. </n-button>
  29. </div>
  30. <CreateModal :show="modalShow" @close="closeHandle" />
  31. </template>
  32. <script setup lang="ts">
  33. import { ref } from 'vue'
  34. import { computed } from 'node_modules/vue/dist/vue'
  35. import { useDesignStore } from '@/store/modules/designStore/designStore'
  36. import { CreateModal } from './components/CreateModal/index'
  37. import { icon } from '@/plugins'
  38. const { DuplicateIcon, DuplicateOutlineIcon } = icon.ionicons5
  39. const designStore = useDesignStore()
  40. const props = defineProps({
  41. collapsed: Boolean
  42. })
  43. const modalShow = ref<boolean>(false)
  44. const clickHandle = () => {
  45. modalShow.value = true
  46. }
  47. const closeHandle = () => {
  48. modalShow.value = false
  49. }
  50. </script>