File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
docs/.vitepress/theme/components Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 11<script setup lang="ts">
2- import { ref , computed } from ' vue'
2+ import { ref , computed , onMounted } from ' vue'
33import { marked } from ' marked'
44
55const deviceDropdownRef = ref <HTMLElement | null >(null )
@@ -167,12 +167,15 @@ function handleClickOutside(event: MouseEvent) {
167167 }
168168}
169169
170- // 重试获取发布信息的方法
171- async function retryFetch() {
170+ onMounted (async () => {
171+ // 添加全局点击事件监听
172+ document .addEventListener (' click' , handleClickOutside )
173+
174+ // 自动获取SecRandom发布信息
172175 isLoading .value = true
173176 hasError .value = false
174177 errorMessage .value = ' '
175-
178+
176179 try {
177180 console .log (' 正在获取GitHub发布信息...' )
178181 // 调用GitHub API获取SecRandom的所有发布信息
@@ -249,7 +252,7 @@ async function retryFetch() {
249252 } finally {
250253 isLoading .value = false
251254 }
252- }
255+ })
253256 </script >
254257
255258onBeforeUnmount(() => {
@@ -320,7 +323,7 @@ onBeforeUnmount(() => {
320323 <!-- 错误状态 -->
321324 <div v-else-if =" hasError" class =" error" >
322325 <p >{{ errorMessage }}</p >
323- <button @click =" retryFetch " class =" retry-button" >重试</button >
326+ <button @click =" onMounted " class =" retry-button" >重试</button >
324327
325328 </div >
326329
You can’t perform that action at this time.
0 commit comments