fix: 修复字典弹窗闪屏并抽取侧栏列表样式
- 字典弹窗挂到 body,避免页面入场动画导致首次打开闪屏 - 抽取侧栏搜索列表为公共 aside-list 样式 - 公共类按结构角色命名,移除业务字段与动作名
This commit is contained in:
1 parent
4c4e12d335
commit
5da3670608
4 files changed
+141
-230
No files matched your search
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "vue3-element-admin",
|
||||
"description": "Vue3 + Vite + TypeScript + Element-Plus 的后台管理模板,vue-element-admin 的 Vue3 版本",
|
||||
"version": "4.14.0",
|
||||
"version": "4.14.1",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -419,6 +419,126 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 侧栏搜索列表:page-aside__inner 内的「搜索 + 滚动列表 + 分页」结构
|
||||
.aside-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
padding: 16px;
|
||||
|
||||
&__head {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
|
||||
.el-input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.el-button {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__scroll {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
&__item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 8px 10px;
|
||||
cursor: pointer;
|
||||
border-radius: var(--radius-control);
|
||||
transition: background-color 0.15s;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--el-fill-color-light);
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
background-color: var(--el-color-primary-light-9);
|
||||
}
|
||||
|
||||
&.is-active::before {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
bottom: 6px;
|
||||
left: 0;
|
||||
width: 2px;
|
||||
content: "";
|
||||
background-color: var(--el-color-primary);
|
||||
border-radius: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
&__info {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
&__title {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&__meta {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&__label {
|
||||
flex: 0 1 auto;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: var(--el-text-color-primary);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__sub {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__tag {
|
||||
flex-shrink: 0;
|
||||
padding: 0 4px;
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
color: var(--el-color-warning);
|
||||
background-color: var(--el-color-warning-light-9);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
&__item.is-active &__label {
|
||||
font-weight: 600;
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
&__item.is-disabled:not(.is-active) &__label {
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
}
|
||||
|
||||
// 侧栏列表行内图标按钮:常驻可见但视觉安静,hover / 聚焦时提亮
|
||||
.aside-actions {
|
||||
display: inline-flex;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<div class="page-container page-container--split dict-page">
|
||||
<aside class="page-aside" :class="{ 'is-collapsed': sidebarCollapsed }">
|
||||
<div class="page-aside__inner">
|
||||
<div class="dict-type">
|
||||
<div class="dict-type__head">
|
||||
<div class="aside-list">
|
||||
<div class="aside-list__head">
|
||||
<el-input
|
||||
v-model="params.keywords"
|
||||
placeholder="搜索字典"
|
||||
@@ -19,31 +19,30 @@
|
||||
v-hasPerm="['sys:dict:create']"
|
||||
type="primary"
|
||||
plain
|
||||
class="dict-type__create"
|
||||
@click="handleCreateClick()"
|
||||
@click="handleCreateClick()"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-scrollbar v-loading="loading" class="dict-type__list">
|
||||
<el-scrollbar v-loading="loading" class="aside-list__scroll">
|
||||
<div
|
||||
v-for="row in list"
|
||||
:key="row.id"
|
||||
class="dict-type__item"
|
||||
class="aside-list__item"
|
||||
:class="{ 'is-active': row.dictCode === currentType?.dictCode }"
|
||||
@click="handleTypeClick(row)"
|
||||
>
|
||||
<div class="dict-type__info">
|
||||
<span class="dict-type__name" :title="row.name">
|
||||
<div class="aside-list__info">
|
||||
<span class="aside-list__label" :title="row.name">
|
||||
<span
|
||||
class="status-dot"
|
||||
:class="{ 'is-stopped': row.status !== CommonStatus.ENABLED }"
|
||||
/>
|
||||
{{ row.name }}
|
||||
</span>
|
||||
<span class="dict-type__code" :title="row.dictCode">{{ row.dictCode }}</span>
|
||||
<span class="aside-list__sub" :title="row.dictCode">{{ row.dictCode }}</span>
|
||||
</div>
|
||||
<div class="aside-actions">
|
||||
<el-button
|
||||
@@ -115,6 +114,7 @@
|
||||
v-model="dialogState.visible"
|
||||
:title="dialogState.title"
|
||||
width="500px"
|
||||
append-to-body
|
||||
@close="closeDialog"
|
||||
>
|
||||
<el-form ref="dictFormRef" :model="formData" :rules="rules" label-width="88px">
|
||||
@@ -350,93 +350,4 @@ onMounted(() => {
|
||||
.dict-page {
|
||||
--page-aside-width: 320px;
|
||||
}
|
||||
|
||||
.dict-type {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
padding: 16px;
|
||||
|
||||
&__head {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
|
||||
:deep(.el-input) {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__create {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
&__list {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
&__item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 8px 10px;
|
||||
cursor: pointer;
|
||||
border-radius: var(--radius-control);
|
||||
transition: background-color 0.15s;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--el-fill-color-light);
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
background-color: var(--el-color-primary-light-9);
|
||||
}
|
||||
|
||||
&.is-active::before {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
bottom: 6px;
|
||||
left: 0;
|
||||
width: 2px;
|
||||
content: "";
|
||||
background-color: var(--el-color-primary);
|
||||
border-radius: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
&__info {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
&__name {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: var(--el-text-color-primary);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__code {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__item.is-active &__name {
|
||||
font-weight: 600;
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
+11
-131
@@ -3,8 +3,8 @@
|
||||
<div class="page-container page-container--split role-page">
|
||||
<aside class="page-aside" :class="{ 'is-collapsed': sidebarCollapsed }">
|
||||
<div class="page-aside__inner">
|
||||
<div class="role-list">
|
||||
<div class="role-list__head">
|
||||
<div class="aside-list">
|
||||
<div class="aside-list__head">
|
||||
<el-input
|
||||
v-model="params.keywords"
|
||||
placeholder="搜索角色"
|
||||
@@ -20,36 +20,35 @@
|
||||
v-hasPerm="'sys:role:create'"
|
||||
type="primary"
|
||||
plain
|
||||
class="role-list__create"
|
||||
@click="handleCreateClick()"
|
||||
@click="handleCreateClick()"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-scrollbar v-loading="loading" class="role-list__scroll">
|
||||
<el-scrollbar v-loading="loading" class="aside-list__scroll">
|
||||
<div
|
||||
v-for="row in list"
|
||||
:key="row.id"
|
||||
class="role-list__item"
|
||||
class="aside-list__item"
|
||||
:class="{
|
||||
'is-active': row.id === currentRole?.id,
|
||||
'is-disabled': row.status === CommonStatus.DISABLED,
|
||||
}"
|
||||
@click="handleRoleClick(row)"
|
||||
>
|
||||
<div class="role-list__info">
|
||||
<span class="role-list__title">
|
||||
<div class="aside-list__info">
|
||||
<span class="aside-list__title">
|
||||
<span
|
||||
class="status-dot"
|
||||
:class="{ 'is-stopped': row.status !== CommonStatus.ENABLED }"
|
||||
/>
|
||||
<span class="role-list__name" :title="row.name">{{ row.name }}</span>
|
||||
<span class="aside-list__label" :title="row.name">{{ row.name }}</span>
|
||||
</span>
|
||||
<span class="role-list__meta">
|
||||
<span class="role-list__code" :title="row.code">{{ row.code }}</span>
|
||||
<span v-if="row.status !== CommonStatus.ENABLED" class="role-list__stopped">
|
||||
<span class="aside-list__meta">
|
||||
<span class="aside-list__sub" :title="row.code">{{ row.code }}</span>
|
||||
<span v-if="row.status !== CommonStatus.ENABLED" class="aside-list__tag">
|
||||
停用
|
||||
</span>
|
||||
</span>
|
||||
@@ -878,125 +877,6 @@ onMounted(() => {
|
||||
--page-aside-width: 280px;
|
||||
}
|
||||
|
||||
.role-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
padding: 16px;
|
||||
|
||||
&__head {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
|
||||
:deep(.el-input) {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__create {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
&__scroll {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
&__item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 8px 10px;
|
||||
cursor: pointer;
|
||||
border-radius: var(--radius-control);
|
||||
transition: background-color 0.15s;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--el-fill-color-light);
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
background-color: var(--el-color-primary-light-9);
|
||||
}
|
||||
|
||||
&.is-active::before {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
bottom: 6px;
|
||||
left: 0;
|
||||
width: 2px;
|
||||
content: "";
|
||||
background-color: var(--el-color-primary);
|
||||
border-radius: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
&__info {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
&__title {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&__name {
|
||||
flex: 0 1 auto;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: var(--el-text-color-primary);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__meta {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&__code {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__stopped {
|
||||
flex-shrink: 0;
|
||||
padding: 0 4px;
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
color: var(--el-color-warning);
|
||||
background-color: var(--el-color-warning-light-9);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
&__item.is-active &__name {
|
||||
font-weight: 600;
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
&__item.is-disabled:not(.is-active) &__name {
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
}
|
||||
|
||||
.role-perm {
|
||||
&__header {
|
||||
display: flex;
|
||||
|
||||
Reference in new issue
Block a user