@@ -13,6 +13,7 @@ import { initializeUpdateProjectState } from '~/views/ProjectEditorView'
1313
1414import LanguageButton from ' ./LanguageButton.vue'
1515import LicenseButton from ' ./LicenseButton.vue'
16+ import type { OpenButtonExpose } from ' ./OpenButton.exposed'
1617import OpenButton from ' ./OpenButton.vue'
1718
1819const props = defineProps <{
@@ -36,14 +37,14 @@ const projectExists = computed(() => projectItem.value.isExists)
3637const { t } = useI18n ()
3738
3839const projectCardRef = ref <HTMLDivElement | null >(null )
39- const openButtonRef = ref <HTMLDivElement | null >(null )
40- const projectCardActive = ref (false )
40+ const openButtonRef = ref <OpenButtonExpose | null >(null )
41+ const projectCardActive = ref < boolean > (false )
4142const langGroup = ref (projectLangGroup .value )
4243
43- const formattedPath = ref ( ' ' )
44+ const formattedPath = computed (() => window . api . formatPath ( projectPath . value ) )
4445
45- async function formatPath( path : string ) {
46- return window . api . formatPath ( path )
46+ function handleClick( ) {
47+ openButtonRef . value ?. handleClick ( )
4748}
4849
4950function handleDragStart(event : DragEvent ) {
@@ -53,10 +54,6 @@ function handleDragStart(event: DragEvent) {
5354 }
5455}
5556
56- function handleClick() {
57- openButtonRef .value ?.handleClick ()
58- }
59-
6057watch (
6158 () => props .projectItem .langGroup ,
6259 (newLangGroup , oldLangGroup ) => {
@@ -67,10 +64,6 @@ watch(
6764 { deep: true },
6865) // 使用 deep 监听 langGroup 的内部变化
6966
70- onMounted (async () => {
71- formattedPath .value = await formatPath (projectPath .value )
72- })
73-
7467// ==================== More Button ====================
7568function getDeleteLabel() {
7669 if (! projectExists .value ) {
@@ -141,8 +134,8 @@ function showMenu() {
141134 cursor-pointer
142135 tabindex =" 0"
143136 draggable =" true"
144- @dragstart =" handleDragStart"
145137 @click.self =" handleClick"
138+ @dragstart =" handleDragStart"
146139 >
147140 <div
148141 :class =" { 'opacity-30': !projectExists }"
@@ -184,11 +177,7 @@ function showMenu() {
184177 text =" secondary"
185178 >
186179 {{ projectKind === ProjectKind.FORK ? 'Forked from' : 'Cloned from' }}
187- <JeLink
188- v-if =" projectFromUrl "
189- type="web"
190- :on-click =" () => openLink (projectFromUrl ) "
191- >
180+ <JeLink v-if =" projectFromUrl " type="web" :on-click =" () => openLink (projectFromUrl ) " >
192181 {{ projectFromName || projectFromUrl }}
193182 </JeLink >
194183 <span v-else >{{ projectFromName }}</span >
0 commit comments