x-php-Admin/src/components/XMenu/item.vue

93 lines
1.5 KiB
Vue
Raw Normal View History

2023-07-09 14:34:43 +00:00
<template>
2023-07-10 16:41:24 +00:00
<div :class="{'is-select':select}" class="x-menu-item">
<i :style="{backgroundColor: select ? iconColor || '#2362FB' : '#edf2f6'}" :class="['x-menu-item__icon', iconClass]" />
2023-07-10 07:54:42 +00:00
<span class="x-menu-item__label">{{ label }}</span>
2023-07-10 16:41:24 +00:00
<el-badge v-if="num > 0" :max="99" :value="num"/>
2023-07-09 14:34:43 +00:00
</div>
</template>
<script>
export default {
// 菜单
2023-07-10 16:41:24 +00:00
name: 'xMenuItem',
2023-07-09 14:34:43 +00:00
components: {},
props: {
iconClass: String,
iconColor: String,
label: String,
// 关键字
name: String,
num: [String, Number],
select: Boolean
},
data() {
return {}
},
computed: {},
watch: {},
mounted() {},
methods: {}
}
</script>
<style lang="scss" scoped>
2023-07-10 07:54:42 +00:00
.x-menu-item {
2023-07-09 14:34:43 +00:00
padding: 12px 20px;
position: relative;
cursor: pointer;
&__icon {
display: inline-block;
font-size: 12px;
padding: 6px;
2023-07-10 07:54:42 +00:00
border-radius: 4px;
2023-07-09 14:34:43 +00:00
background-color: #edf2f6;
color: #8a94a6;;
}
&__label {
color: #333;
font-size: 13px;
margin-left: 10px;
}
&.is-select {
2023-07-10 07:54:42 +00:00
.x-menu-item__icon {
/* background-color: $x-color-primary;*/
2023-07-09 14:34:43 +00:00
color: white;
}
}
}
2023-07-10 07:54:42 +00:00
.x-menu-item.is-select,
.x-menu-item:hover {
2023-07-09 14:34:43 +00:00
background-color: #f6f8fa;
}
2023-07-10 07:54:42 +00:00
.x-menu-item::before {
2023-07-09 14:34:43 +00:00
content: ' ';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 2px;
background-color: #2362fb;
opacity: 0;
}
2023-07-10 07:54:42 +00:00
.x-menu-item.is-select::before {
2023-07-09 14:34:43 +00:00
opacity: 1;
}
.el-badge .el-badge__content {
border: none;
top: 0;
}
.el-badge {
position: absolute;
right: 10px;
top: 15px;
}
</style>