feat(frontend): 打磨管理台交互体验与可访问性
- 优化 Dashboard、Bindings、Logs、Settings 的布局、筛选区与信息层级 - 增加筛选状态同步、未保存提醒、运行时反馈和趋势表视图 - 补充跳转主内容、aria live、键盘导航与移动端触控细节
This commit is contained in:
@@ -2,16 +2,25 @@ import { ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
import { humanizeError } from '../api'
|
||||
import { announcePolite } from '../utils/liveRegion'
|
||||
|
||||
export function useAsyncAction() {
|
||||
const loading = ref(false)
|
||||
const errorMessage = ref('')
|
||||
|
||||
function clearError() {
|
||||
errorMessage.value = ''
|
||||
}
|
||||
|
||||
async function run(task, fallbackMessage) {
|
||||
loading.value = true
|
||||
clearError()
|
||||
try {
|
||||
return await task()
|
||||
} catch (error) {
|
||||
ElMessage.error(humanizeError(error, fallbackMessage))
|
||||
errorMessage.value = humanizeError(error, fallbackMessage)
|
||||
announcePolite(errorMessage.value)
|
||||
ElMessage.error(errorMessage.value)
|
||||
throw error
|
||||
} finally {
|
||||
loading.value = false
|
||||
@@ -19,6 +28,8 @@ export function useAsyncAction() {
|
||||
}
|
||||
|
||||
return {
|
||||
clearError,
|
||||
errorMessage,
|
||||
loading,
|
||||
run,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user