Repository navigation
perf: style #7868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: style #7868
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -612,6 +612,9 @@ | |
| /* form */ | ||
| .el-form-item { | ||
| margin-bottom: calc(var(--spacing) * 4); | ||
| &.mk-form-item-with-avatar > .el-form-item__content > .el-form-item__error { | ||
| padding-left: calc(32px + var(--spacing) * 3); | ||
| } | ||
| &.small { | ||
| margin-bottom: calc(var(--spacing) * 2); | ||
| } | ||
|
|
@@ -1146,7 +1149,8 @@ | |
| .el-table { | ||
| --el-table-header-bg-color: var(--mk-N100); | ||
| --el-table-text-color: var(--el-text-color-primary); | ||
| --el-table-row-hover-bg-color: color-mix(in srgb, var(--el-color-primary) 4%, white); | ||
| --el-table-row-hover-bg-color: var(--mk-N200); | ||
| // --el-table-row-hover-bg-color: var(--el-color-primary-light-9); | ||
| --el-table-border-color: var(--el-border-color); | ||
| border-radius: var(--radius-xl) var(--radius-xl) 0 0; | ||
|
|
||
|
|
@@ -1165,6 +1169,10 @@ | |
| line-height: var(--mk-line-height-base); | ||
| padding: calc(var(--spacing) * 3); | ||
| } | ||
| // 多选列勾选后,整行(含固定列)保持选中底色。 | ||
| .el-table__row:has(> .el-table-column--selection .el-checkbox.is-checked) > .el-table__cell { | ||
| background-color: var(--el-color-primary-light-9); | ||
| } | ||
| &.small { | ||
| .cell { | ||
| padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is the review of the provided CSS/SCSS code: 1. Irregularities & Potential IssuesA. Hardcoded Value (
B.
C. Specificity & Element Plus Internal Class Names
D. Commented-Out Code
2. Optimization SuggestionsA. Use :root {
--mk-avatar-width: 32px;
}
.mk-form-item-with-avatar > .el-form-item__content > .el-form-item__error {
padding-left: calc(var(--mk-avatar-width) + var(--spacing) * 3);
}B. Alternative to
C. Variable Consistency
Summary of Recommendations
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,12 @@ defineOptions({ name: 'ToolFormDrawer' }) | |
| const { auth } = useStore() | ||
|
|
||
| const props = withDefaults( | ||
| defineProps<{ api: typeof ToolApi | typeof SystemSharedToolApi | typeof SystemResourceToolApi; title: string; folderId: string; canEdit?: boolean }>(), | ||
| defineProps<{ | ||
| api: typeof ToolApi | typeof SystemSharedToolApi | typeof SystemResourceToolApi | ||
| title: string | ||
| folderId: string | ||
| canEdit?: boolean | ||
| }>(), | ||
| { canEdit: true }, | ||
| ) | ||
|
|
||
|
|
@@ -186,7 +191,7 @@ defineExpose({ open }) | |
| @submit.prevent | ||
| > | ||
| <h4 class="mk-title-decoration mb-4">基本信息</h4> | ||
| <el-form-item label="名称" prop="name"> | ||
| <el-form-item class="mk-form-item-with-avatar" label="名称" prop="name"> | ||
| <div class="flex-align-center w-full gap-3"> | ||
| <MkEditAvatar v-model="toolForm.icon" @change="handleIconChange"> | ||
| <template #default="{ icon }"> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is the review of the provided code diff: 1. Irregularities & Potential Issues
2. Optimization Suggestions & Best PracticesA. Props Definition Type Safety (TypeScript/Vue)Using
B. CSS Class Naming ConventionYou added
C. Code Formatting (Prettier/ESLint)
SummaryThe changes are safe and beneficial for readability. No functional issues found. Focus on long-term maintainability of the |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No syntax errors are apparent, and the watcher generally implements the intended “same application: 0 → >0 conversations, auto-expand once” behavior. The
previousCount !== 0guard correctly prevents later message-count changes from overriding a manual collapse.Potential issues / suggestions:
Missed auto-expand when app ID and count change in the same flush
currentApplicationIdchanges and the new app already has conversations in the same tick, the guardapplicationId !== previousApplicationIdreturns early, so the group is not expanded.No retry if the group is not found
portalList.applicationGroups.valuehas not been updated/loaded yet,find(...)returnsundefined, and the expansion is permanently skipped because the count transition is already consumed.{ flush: 'post' }ornextTick()if group availability can lag behind conversation changes.Manual collapse can be overridden after conversations become empty
count = 0) → a new conversation arrives (count = 1) → watcher expands again.userCollapsed/autoExpandDoneflag instead of relying only onpreviousCount === 0.Direct mutation of
group.expandedgroup.expanded = trueassumes the group object is deeply reactive/mutable.applicationGroupsis ashallowRef, readonly, frozen, or computed structure, this mutation may not trigger UI updates. Prefer a centralized action such asportalList.expandGroup(applicationId).Watcher cleanup
createPortalConversationcan be called outside a component setup scope, the watcher may not be automatically disposed. Verify lifecycle handling or dispose it explicitly.No
immediateimmediatewith explicit initialization logic.Optimization suggestion:
Use separate watch sources instead of constructing a new tuple array on each evaluation. This is slightly clearer and avoids unnecessary tuple allocation:
Overall: the logic is acceptable for the stated narrow case, but it is fragile around group-loading timing and manual-collapse persistence. I’d recommend using a
flush: 'post'watcher and, if manual collapse must be respected across empty/non-empty transitions, storing explicit expansion state per group.