perf: more appropriate HTML structure (#159)

- 调整 HTML,使结构更贴合标签语义
- 移除部分不会生效的 CSS
This commit is contained in:
YangQi 2022-07-26 19:11:16 +08:00 committed by GitHub
parent 1d1f3891d9
commit 64ead3b714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,21 +1,21 @@
<template> <template>
<ul <div
v-show="value"
id="menu" id="menu"
class="menu" class="menu"
v-show="value"
:style="`left: ${left}px;top: ${top}px;`" :style="`left: ${left}px;top: ${top}px;`"
> >
<div class="menu__group" v-for="(menuItem, index) in menu" :key="index"> <ul class="menu__group" v-for="(menuItem, index) in menu" :key="index">
<li <li
v-for="item of menuItem"
:key="item.key"
class="menu_item" class="menu_item"
@mousedown="onMouseDown(item.key)" v-for="{ key, text } of menuItem"
:key="key"
@mousedown="onMouseDown(key)"
> >
<span>{{ item.text }}</span> {{ text }}
</li> </li>
</div> </ul>
</ul> </div>
</template> </template>
<script> <script>
@ -94,54 +94,36 @@ export default {
} }
.menu_item { .menu_item {
list-style: none;
box-sizing: border-box;
padding: 4px 0 4px 24px;
margin-top: 10px; margin-top: 10px;
min-width: 200px; min-width: 200px;
font-size: 12px; font-size: 12px;
line-height: 20px; line-height: 20px;
color: #333333; color: #333333;
cursor: pointer; cursor: pointer;
&:first-of-type { &:first-of-type {
margin-top: 0; margin-top: 0;
} }
&:hover { &:hover {
background: #f0f0f0; background: #f0f0f0;
} }
span,
.btn-upload {
display: inline-block;
padding: 4px 0;
padding-left: 24px;
width: 100%;
}
.btn-upload {
margin: 0;
border: none;
outline: none;
background: transparent;
}
.btn-upload:hover {
background: #aaaaaa;
}
::v-deep .el-upload { ::v-deep .el-upload {
width: 100%; width: 100%;
} }
} }
.menu__group { .menu__group {
padding-top: 6px; margin: 0;
padding-bottom: 6px; padding: 6px 0;
border-bottom: 1px solid #eeeeee; border-bottom: 1px solid #eeeeee;
&:last-of-type { &:last-of-type {
border-bottom: none; border-bottom: none;
} }
} }
li:hover {
background-color: #1790ff;
}
li {
font-size: 15px;
list-style: none;
}
</style> </style>