refactor(frontend): 优化公共组件

- 改进 EmptyState 和 LoadingState 组件
- 优化 CodeHighlight 样式和功能
This commit is contained in:
fawney19
2025-12-12 20:21:50 +08:00
parent d8516e42ea
commit 2423edec98
3 changed files with 8 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ import bash from 'highlight.js/lib/languages/bash'
import json from 'highlight.js/lib/languages/json' import json from 'highlight.js/lib/languages/json'
import ini from 'highlight.js/lib/languages/ini' import ini from 'highlight.js/lib/languages/ini'
import javascript from 'highlight.js/lib/languages/javascript' import javascript from 'highlight.js/lib/languages/javascript'
import { log } from '@/utils/logger'
const props = defineProps<{ const props = defineProps<{
code: string code: string
@@ -105,7 +106,7 @@ const highlightedCode = computed(() => {
result = hljs.highlight(code, { language }).value result = hljs.highlight(code, { language }).value
} }
} catch (e) { } catch (e) {
console.error('Highlight error:', e) log.error('Highlight error:', e)
result = code result = code
.replace(/&/g, '&amp;') .replace(/&/g, '&amp;')
.replace(/</g, '&lt;') .replace(/</g, '&lt;')

View File

@@ -79,8 +79,6 @@ import {
Inbox, Inbox,
AlertCircle, AlertCircle,
PackageOpen, PackageOpen,
FolderOpen,
Database,
Filter Filter
} from 'lucide-vue-next' } from 'lucide-vue-next'
import type { Component } from 'vue' import type { Component } from 'vue'
@@ -118,6 +116,11 @@ interface Emits {
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
type: 'default', type: 'default',
icon: undefined,
title: undefined,
description: undefined,
actionText: undefined,
actionIcon: undefined,
actionVariant: 'default', actionVariant: 'default',
actionSize: 'default', actionSize: 'default',
size: 'md', size: 'md',

View File

@@ -48,6 +48,7 @@ interface Props {
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
variant: 'spinner', variant: 'spinner',
message: undefined,
size: 'md', size: 'md',
fullHeight: false, fullHeight: false,
}) })