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

View File

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

View File

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