diff --git a/src/App.vue b/src/App.vue index e11f8af..e04972f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,7 +2,7 @@ import { useRouter } from 'vue-router' const router = useRouter() -router.push('/project') +router.push('/config') @@ -82,8 +181,21 @@ const handleConfigChange = () => { .config-section { background: #fff; border-radius: 8px; - padding: 20px; + padding: 24px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); + margin-bottom: 24px; +} + +.group-header { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 16px; +} + +.group-title { + font-size: 18px; + color: #333; } .config-item { @@ -91,43 +203,114 @@ const handleConfigChange = () => { align-items: center; justify-content: space-between; padding: 12px 0; - border-bottom: 1px solid #eee; } -.config-item:last-child { - border-bottom: none; +.item-info { + flex: 1; + margin-right: 24px; } -.config-item label { +.item-label { font-size: 14px; - color: #333; + color: rgba(0, 0, 0, 0.87); } -.config-item select { - padding: 6px 12px; +.item-description { + font-size: 12px; + color: rgba(0, 0, 0, 0.45); + margin-top: 4px; + line-height: 1.5; +} + +/* 输入框通用包装器 */ +.input-wrapper { + position: relative; + width: 200px; +} + +.input-wrapper input { + width: 100%; + padding: 8px 12px; + outline: none; + font-size: 14px; border: 1px solid #ddd; border-radius: 4px; - font-size: 14px; - min-width: 120px; + transition: all 0.2s; + box-sizing: border-box; } -.config-actions { - margin-top: 24px; - text-align: right; +.input-wrapper input:focus { + border-color: #1976d2; } -.save-button { - background: #1976d2; - color: white; - border: none; - padding: 8px 24px; +/* 开关样式 */ +.switch { + position: relative; + display: inline-block; + width: 40px; + height: 20px; +} + +.switch input { + opacity: 0; + width: 0; + height: 0; +} + +.slider { + position: absolute; + cursor: pointer; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: #ccc; + transition: 0.3s; + border-radius: 20px; +} + +.slider:before { + position: absolute; + content: ""; + height: 16px; + width: 16px; + left: 2px; + bottom: 2px; + background-color: white; + transition: 0.3s; + border-radius: 50%; + box-shadow: 0 1px 2px rgba(0,0,0,0.2); +} + +.switch input:checked + .slider { + background-color: #1976d2; +} + +.switch input:checked + .slider:before { + transform: translateX(20px); + background-color: white; +} + +/* 下拉选择框样式 */ +.select-wrapper { + position: relative; + width: 200px; +} + +.select-wrapper select { + width: 100%; + padding: 8px 12px; + border: 1px solid #ddd; border-radius: 4px; + appearance: none; + background: white; font-size: 14px; cursor: pointer; - transition: background-color 0.2s; + outline: none; + transition: all 0.2s; } -.save-button:hover { - background: #1565c0; +.select-wrapper select:focus { + border-color: #1976d2; } \ No newline at end of file diff --git a/src/types/config.ts b/src/types/config.ts new file mode 100644 index 0000000..1b7f3c3 --- /dev/null +++ b/src/types/config.ts @@ -0,0 +1,48 @@ +// 配置项类型枚举 +export enum ConfigItemType { + TEXT = 'text', + SWITCH = 'switch', + SELECT = 'select' +} + +// 配置项选项接口 +export interface ConfigOption { + label: string + value: string | number | boolean +} + +// 基础配置项接口 +export interface BaseConfigItem { + type: ConfigItemType + key: string + label: string + value: any + description?: string // 配置项的详细说明 +} + +// 文本配置项 +export interface TextConfigItem extends BaseConfigItem { + type: ConfigItemType.TEXT + value: string + placeholder?: string +} + +// 开关配置项 +export interface SwitchConfigItem extends BaseConfigItem { + type: ConfigItemType.SWITCH + value: boolean +} + +// 选择配置项 +export interface SelectConfigItem extends BaseConfigItem { + type: ConfigItemType.SELECT + value: string + options: ConfigOption[] +} + +// 配置项组 +export interface ConfigGroup { + title: string + enabled: boolean + items: (TextConfigItem | SwitchConfigItem | SelectConfigItem)[] +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 427ea86..ea33fa8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,8 +23,7 @@ ] }, "types": [ - "vue-router", - "mousetrap" + "vue-router" ] }, "include": [