index.vue
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<template>
<div @click="clickHandle">
<n-tooltip v-if="collapsed" placement="right" trigger="hover">
<template #trigger>
<n-button ghost type="primary" size="small">
<template #icon>
<n-icon>
<DuplicateOutlineIcon v-show="designStore.getDarkTheme"></DuplicateOutlineIcon>
<DuplicateIcon v-show="!designStore.getDarkTheme"></DuplicateIcon>
</n-icon>
</template>
</n-button>
</template>
<span>
{{ $t('project.create_btn') }}
</span>
</n-tooltip>
<n-button v-else ghost type="primary">
<template #icon>
<n-icon>
<DuplicateOutlineIcon v-show="designStore.getDarkTheme"></DuplicateOutlineIcon>
<DuplicateIcon v-show="!designStore.getDarkTheme"></DuplicateIcon>
</n-icon>
</template>
<span>
{{ $t('project.create_btn') }}
</span>
</n-button>
</div>
<CreateModal :show="modalShow" @close="closeHandle"></CreateModal>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { useDesignStore } from '@/store/modules/designStore/designStore'
import { CreateModal } from './components/CreateModal/index'
import { icon } from '@/plugins'
import { getUUID } from '@/utils'
const { DuplicateIcon, DuplicateOutlineIcon } = icon.ionicons5
const designStore = useDesignStore()
defineProps({
collapsed: Boolean
})
const modalShow = ref<boolean>(false)
const clickHandle = () => {
const { host, protocol, pathname } = location
const randomId = getUUID(32)
window.open(`${protocol}//${host}${pathname}editor/?three_file_uuid=${randomId}&action_type=create`)
}
const closeHandle = () => {
modalShow.value = false
}
</script>