Skip to content

Commit 8a9851d

Browse files
committed
feat: 添加手动检测环境
1 parent 363fe1f commit 8a9851d

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/App.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
</div>
5353

5454
<!-- 状态栏 -->
55-
<StatusBar :env-info="envInfo" :is-loading="isLoadingEnvInfo" :execution-time="lastExecutionTime" :code-length="(code || '').length"/>
55+
<StatusBar :env-info="envInfo" :is-loading="isLoadingEnvInfo" :execution-time="lastExecutionTime" :code-length="(code || '').length" @check-environment="refreshEnvInfo"/>
5656

5757
<!-- 关于组件 -->
5858
<About v-if="showAbout" @close="closeAbout"/>
@@ -115,6 +115,7 @@ const {
115115
getCurrentConsoleType,
116116
handleLanguageChange,
117117
refreshLanguageList,
118+
refreshEnvInfo,
118119
initialize
119120
} = useLanguageManager(code, clearOutput, toast)
120121

src/components/StatusBar.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
:class="[getIconClass(), { 'animate-spin': isLoading }]"
88
class="w-4 h-4"/>
99
<span>{{ getStatusText() }}</span>
10+
<button @click="handleCheckEnvironment"
11+
:disabled="isLoading"
12+
class="ml-2 p-1 rounded cursor-pointer hover:bg-white/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
13+
title="重新检查环境">
14+
<RefreshCw :class="{ 'animate-spin': isLoading }" class="w-3.5 h-3.5"/>
15+
</button>
1016
</div>
1117

1218
<div v-if="executionTime > 0" class="flex items-center space-x-2">
@@ -25,7 +31,7 @@
2531
</template>
2632

2733
<script setup lang="ts">
28-
import { Clock, Hash } from 'lucide-vue-next'
34+
import { Clock, Hash, RefreshCw } from 'lucide-vue-next'
2935
import { toRefs } from 'vue'
3036
import { useStatusBar } from '../composables/useStatusBar'
3137
@@ -41,6 +47,10 @@ const props = defineProps<{
4147
codeLength: number
4248
}>()
4349
50+
const emit = defineEmits<{
51+
checkEnvironment: []
52+
}>()
53+
4454
const { envInfo, isLoading } = toRefs(props)
4555
4656
const {
@@ -49,4 +59,8 @@ const {
4959
getIconClass,
5060
getStatusText
5161
} = useStatusBar(envInfo, isLoading)
62+
63+
const handleCheckEnvironment = () => {
64+
emit('checkEnvironment')
65+
}
5266
</script>

src/composables/useLanguageManager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ export function useLanguageManager(
203203
getLanguageDisplayName,
204204
handleLanguageChange,
205205
refreshLanguageList,
206+
refreshEnvInfo,
206207
initialize,
207208
getCurrentPluginConfig,
208209
getCurrentConsoleType

0 commit comments

Comments
 (0)