diff --git a/app/components/UploadArea.vue b/app/components/UploadArea.vue index 254ad6f..f3eac49 100644 --- a/app/components/UploadArea.vue +++ b/app/components/UploadArea.vue @@ -4,11 +4,13 @@
- - + +
+ + - - + + +
{ // 配置 const allowedFormats = ref(['jpeg', 'jpg', 'png', 'gif', 'webp', 'avif', 'svg', 'bmp', 'ico', 'apng', 'tiff', 'tif']) const maxFileSize = ref(10 * 1024 * 1024) // 10MB -const publicApiEnabled = ref(true) +// 初始值为 null,表示配置尚未加载 +const publicApiEnabled = ref(null) const defaultApiKey = ref('') // 计算是否禁用上传(未登录且公共上传已禁用) +// 配置未加载时(null),不显示禁用状态,避免闪烁 const isDisabled = computed(() => { - return !authStore.isAuthenticated && !publicApiEnabled.value + if (!configLoaded.value) return false + return !authStore.isAuthenticated && publicApiEnabled.value === false }) // 计算接受的文件类型 @@ -225,6 +250,9 @@ async function fetchConfig() { } } catch (error) { console.error('获取配置失败:', error) + } finally { + // 标记配置已加载完成 + configLoaded.value = true } } diff --git a/app/pages/index.vue b/app/pages/index.vue index d844527..01b3515 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -84,9 +84,9 @@ - +