style: update App.vue and IconInput.vue for consistent auth UI

This commit is contained in:
2025-12-29 20:37:14 +08:00
parent ad0ab87747
commit a40b768f3b
2 changed files with 20 additions and 34 deletions
+3 -19
View File
@@ -1,37 +1,21 @@
<script setup>
</script>
<template> <template>
<div id="app"> <div id="app">
<!-- <RouterView></RouterView>
<WindowLayout>
-->
<RouterView></RouterView>
<!---
</WindowLayout>
-->
<Alert></Alert> <Alert></Alert>
</div> </div>
</template> </template>
<script setup> <script setup>
import WindowLayout from './components/Window.vue'
import Alert from '@/components/messages/Alert.vue'; import Alert from '@/components/messages/Alert.vue';
</script> </script>
<style scoped> <style scoped>
#app { #app {
display: flex;
justify-content: center;
align-items: center;
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
padding: 150px;
margin: 0; margin: 0;
box-sizing: border-box; padding: 0;
background: radial-gradient(circle at 50% 30%, #eef2ff, #e2e8f0); overflow: hidden;
} }
</style> </style>
+17 -15
View File
@@ -109,55 +109,57 @@ label {
text-decoration: none; text-decoration: none;
} }
/* 输入框样式:现代填充风格 */ /* 输入框样式:现代线框风格 */
.field-wrap { .field-wrap {
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.field-wrap .icon { .field-wrap .icon {
/* .icon 是 <i> 占位符,定位父容器 */
position: absolute; position: absolute;
left: 12px; left: 12px;
width: 18px; width: 18px;
height: 18px; height: 18px;
color: #94a3b8; /* 默认图标颜色 */ color: #94a3b8;
transition: color 0.2s; transition: color 0.2s;
/* Feather icons 渲染后,SVG会继承这个颜色 */ pointer-events: none; /* Icon shouldn't block input click */
z-index: 10;
} }
/* 确保渲染后的 SVG 元素颜色能够正确继承 */
.field-wrap .icon > svg { .field-wrap .icon > svg {
/* 确保 SVG 自身不被其他默认样式影响 */
display: block; display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
stroke: currentColor; /* 使用父元素的颜色 */ stroke: currentColor;
transition: stroke 0.2s; transition: stroke 0.2s;
} }
.field-wrap input { .field-wrap input {
padding: 12px 12px 12px 40px; padding: 12px 12px 12px 40px;
background: #f1f5f9; /* 浅灰底色 */ background: #fff;
border: 2px solid transparent; border: 1px solid #e2e8f0;
border-radius: 8px; border-radius: 8px;
font-size: 14px; font-size: 14px;
color: #1e293b; color: #1e293b;
outline: none; outline: none;
transition: all 0.2s ease; transition: all 0.2s ease;
width: 100%;
} }
/* 聚焦交互 */ /* 聚焦交互 */
.field-wrap input:focus { .field-wrap input:focus {
background: #fff; border-color: #6366f1; /* 品牌色 */
border-color: #4f46e5; /* 品牌色 */ box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); /* 柔和光晕 */
box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1); }
/* 错误状态 (Optional, if you pass a prop later) */
.field-wrap input.error {
border-color: #ef4444;
} }
/* 🚨 关键:聚焦时图标颜色变化的选择器 */ /* 🚨 关键:聚焦时图标颜色变化的选择器 */
/* 当 input 聚焦时,选择它后面的所有兄弟元素 (~),其中类名为 .icon 的元素,改变它的颜色 */
/* 由于我们在 .icon 元素上设置了 colorSVG 会自动继承 */
.field-wrap input:focus ~ .icon { .field-wrap input:focus ~ .icon {
color: #4f46e5; /* 聚焦时的颜色 */ color: #6366f1; /* 聚焦时的颜色 */
} }
</style> </style>