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>
<ul
v-show="value"
<div
id="menu"
class="menu"
v-show="value"
: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
v-for="item of menuItem"
:key="item.key"
class="menu_item"
@mousedown="onMouseDown(item.key)"
v-for="{ key, text } of menuItem"
:key="key"
@mousedown="onMouseDown(key)"
>
<span>{{ item.text }}</span>
{{ text }}
</li>
</div>
</ul>
</ul>
</div>
</template>
<script>
@ -94,54 +94,36 @@ export default {
}
.menu_item {
list-style: none;
box-sizing: border-box;
padding: 4px 0 4px 24px;
margin-top: 10px;
min-width: 200px;
font-size: 12px;
line-height: 20px;
color: #333333;
cursor: pointer;
&:first-of-type {
margin-top: 0;
}
&:hover {
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 {
width: 100%;
}
}
.menu__group {
padding-top: 6px;
padding-bottom: 6px;
margin: 0;
padding: 6px 0;
border-bottom: 1px solid #eeeeee;
&:last-of-type {
border-bottom: none;
}
}
li:hover {
background-color: #1790ff;
}
li {
font-size: 15px;
list-style: none;
}
</style>