refactor: ♻️ 菜单搜索面板样式优化和代码重构
This commit is contained in:
@@ -32,7 +32,7 @@
|
|||||||
<li
|
<li
|
||||||
v-for="(item, index) in displayResults"
|
v-for="(item, index) in displayResults"
|
||||||
:key="item.path"
|
:key="item.path"
|
||||||
:class="{ active: index === activeIndex }"
|
:class="{ 'search-result__item--active': index === activeIndex }"
|
||||||
@click="navigateToRoute(item)"
|
@click="navigateToRoute(item)"
|
||||||
>
|
>
|
||||||
<el-icon v-if="item.icon && item.icon.startsWith('el-icon')">
|
<el-icon v-if="item.icon && item.icon.startsWith('el-icon')">
|
||||||
@@ -48,16 +48,22 @@
|
|||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<div class="i-svg:enter w-5 h-5" />
|
<div class="dialog-footer__shortcut">
|
||||||
<span>选择</span>
|
<div class="i-svg:enter" />
|
||||||
|
</div>
|
||||||
|
<span class="dialog-footer__text mr-3">选择</span>
|
||||||
|
|
||||||
<div class="i-svg:down w-5 h-5 ml-5" />
|
<div class="dialog-footer__shortcut">
|
||||||
<div class="i-svg:up w-5 h-5 ml-5" />
|
<div class="i-svg:down" />
|
||||||
<span>切换</span>
|
</div>
|
||||||
|
<div class="dialog-footer__shortcut ml-1">
|
||||||
<div class="i-svg:esc w-5 h-5ml-5" />
|
<div class="i-svg:up" />
|
||||||
|
</div>
|
||||||
<span>退出</span>
|
<span class="dialog-footer__text mr-3">切换</span>
|
||||||
|
<div class="dialog-footer__shortcut">
|
||||||
|
<div class="i-svg:esc" />
|
||||||
|
</div>
|
||||||
|
<span class="dialog-footer__text">退出</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@@ -174,25 +180,28 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped lang="scss">
|
||||||
.search-result {
|
.search-result {
|
||||||
max-height: 400px;
|
max-height: 400px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
||||||
|
ul {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-result ul li {
|
&__item {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
|
||||||
|
|
||||||
.search-result ul li.active {
|
&--active {
|
||||||
background-color: #e6f7ff;
|
color: $menu-active-text;
|
||||||
|
background-color: $menu-hover;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-result ul li:hover {
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-footer {
|
.dialog-footer {
|
||||||
@@ -200,25 +209,32 @@ onMounted(() => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: start;
|
justify-content: start;
|
||||||
|
|
||||||
svg {
|
&__shortcut {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 0 2px;
|
width: 20px;
|
||||||
margin-right: 0.4em;
|
height: 18px;
|
||||||
color: #909399;
|
padding: 0 0 1px;
|
||||||
background: rgb(125 125 125 / 10%);
|
color: var(--el-text-color-secondary);
|
||||||
|
background: rgba(125, 125, 125, 0.1);
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
box-shadow:
|
box-shadow:
|
||||||
inset 0 -2px 0 0 #cdcde6,
|
inset 0 -2px 0 0 #cdcde6,
|
||||||
inset 0 0 1px 1px #fff,
|
inset 0 0 1px 1px #fff,
|
||||||
0 1px 2px 1px rgb(30 35 90 / 40%);
|
0 1px 2px 1px rgba(30, 35, 90, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
&__text {
|
||||||
font-size: 12px;
|
margin-left: 5px;
|
||||||
color: #909399;
|
font-size: 14px;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[class^="i-svg:"] {
|
||||||
|
display: inline-block;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user