|
|
|
@ -1,53 +1,25 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
|
|
|
|
<el-menu |
|
|
|
<el-menu class="top-menu custom-menu" :default-active="activeIndex" mode="horizontal" ellipsis |
|
|
|
class="top-menu custom-menu" |
|
|
|
style="width: 900px" v-if="setting.styleRadio != '3'"> |
|
|
|
:default-active="activeIndex1" |
|
|
|
<!-- <el-menu-item index="0" @click="openHome(itemHome)"> |
|
|
|
mode="horizontal" |
|
|
|
<template #title> |
|
|
|
ellipsis |
|
|
|
<i :class="itemHome.source" style="padding-right: 5px"></i> |
|
|
|
style="width: 1100px" |
|
|
|
<span>{{ itemHome.name }}</span> |
|
|
|
v-if="setting.styleRadio == '4'&&menu.length>0" |
|
|
|
</template> |
|
|
|
> |
|
|
|
</el-menu-item> --> |
|
|
|
<el-menu-item |
|
|
|
<template v-for="(item, index) in items" :key="index"> |
|
|
|
v-for="(item, index) in items" |
|
|
|
<el-menu-item :index="item.id + ''" @click="openMenu(item)" > |
|
|
|
:key="index" |
|
|
|
|
|
|
|
:index="index + ''" |
|
|
|
|
|
|
|
@click="openMenu(item)" |
|
|
|
|
|
|
|
> |
|
|
|
<template #title> |
|
|
|
<template #title> |
|
|
|
<i :class="item.source" style="padding-right: 5px"></i> |
|
|
|
<i :class="item.source" style="padding-right: 5px"></i> |
|
|
|
<span>{{ item.name }}</span> |
|
|
|
<span>{{ item.name }}</span> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-menu-item> |
|
|
|
</el-menu-item> |
|
|
|
</template> |
|
|
|
|
|
|
|
</el-menu> |
|
|
|
</el-menu> |
|
|
|
<div class="top_menu_box" v-if="setting.styleRadio == '3' || setting.styleRadio == '6'"> |
|
|
|
|
|
|
|
<div v-for="(item, index) in items" :key="index" @click="openMenu(item)"> |
|
|
|
|
|
|
|
<div class="top_menu_box_item" v-if="index <= 7" :class="activeIndex == item.id ? 'active' : ''"> |
|
|
|
|
|
|
|
<i :class="item.source" style="padding-right: 5px"></i> |
|
|
|
|
|
|
|
<span>{{ item.name }}</span> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div v-show="items.length > 9"> |
|
|
|
|
|
|
|
<el-popover placement="bottom-start" :show-arrow="false" :offset="0" :hide-after='0' popper-class="log-popover" |
|
|
|
|
|
|
|
popper-style="visibility: visible;width:auto;border:none; transform-origin: left center; z-index: 2051;padding:0;offset:0 !important;"> |
|
|
|
|
|
|
|
<template #reference> |
|
|
|
|
|
|
|
<div style="height:100%;display: flex;align-items: center;"> |
|
|
|
|
|
|
|
<el-icon class="el-icon--right" style="width: 16px;height: 16px;" color="#fff"> |
|
|
|
|
|
|
|
<arrow-down /> |
|
|
|
|
|
|
|
</el-icon> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
<template #default> |
|
|
|
|
|
|
|
<div v-if="items.length > 7"> |
|
|
|
|
|
|
|
<div v-for="item in items.filter((item, index) => index > 7)" style="padding: 10px;cursor: pointer; " |
|
|
|
|
|
|
|
@click="openMenu(item)"> |
|
|
|
|
|
|
|
<div>{{ item.name }}</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</el-popover> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
@ -64,18 +36,46 @@ export default { |
|
|
|
name: '首页', |
|
|
|
name: '首页', |
|
|
|
source: 'iconfont iconicon_work', |
|
|
|
source: 'iconfont iconicon_work', |
|
|
|
}, |
|
|
|
}, |
|
|
|
// activeIndex: '0', |
|
|
|
activeIndex1: '0', |
|
|
|
items: [], |
|
|
|
items: [], |
|
|
|
timer: null |
|
|
|
timer: null, |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
inject: ['index'], |
|
|
|
inject: ['index'], |
|
|
|
created() { |
|
|
|
created() { |
|
|
|
|
|
|
|
// 先检查store中是否已有数据,没有则等待或主动获取 |
|
|
|
|
|
|
|
if (this.menu.length === 0) { |
|
|
|
|
|
|
|
// 监听store中menu的变化(如果是Vuex,可通过watch监听) |
|
|
|
|
|
|
|
this.$watch( |
|
|
|
|
|
|
|
() => this.menu, |
|
|
|
|
|
|
|
(newVal) => { |
|
|
|
|
|
|
|
if (newVal.length > 0) { |
|
|
|
|
|
|
|
this.getMenu(); // 数据就绪后再处理 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ immediate: true } |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
this.getMenu(); |
|
|
|
this.getMenu(); |
|
|
|
this.interval() |
|
|
|
} |
|
|
|
|
|
|
|
this.interval(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
|
...mapGetters(['tagCurrent', 'menu', 'tagWel', 'activeIndex', 'selectIndex', 'selectedIndex', 'leftMenu', 'setting']), |
|
|
|
...mapGetters([ |
|
|
|
|
|
|
|
'tagCurrent', |
|
|
|
|
|
|
|
'menu', |
|
|
|
|
|
|
|
'tagWel', |
|
|
|
|
|
|
|
'activeIndex', |
|
|
|
|
|
|
|
'selectIndex', |
|
|
|
|
|
|
|
'selectedIndex', |
|
|
|
|
|
|
|
'leftMenu', |
|
|
|
|
|
|
|
'setting', |
|
|
|
|
|
|
|
]), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
mounted() { |
|
|
|
|
|
|
|
// this.getMenu(); |
|
|
|
|
|
|
|
// this.interval(); |
|
|
|
|
|
|
|
// console.log(89898, this.menu); |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
openMenu(item) { |
|
|
|
openMenu(item) { |
|
|
|
@ -97,20 +97,20 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
interval() { |
|
|
|
interval() { |
|
|
|
this.timer = setInterval(() => { |
|
|
|
this.timer = setInterval(() => { |
|
|
|
this.getMenu() |
|
|
|
this.getMenu(); |
|
|
|
}, 1000) |
|
|
|
}, 1000); |
|
|
|
}, |
|
|
|
}, |
|
|
|
getMenu() { |
|
|
|
getMenu() { |
|
|
|
this.items = this.menu |
|
|
|
this.items = this.menu; |
|
|
|
if (this.menu.length != 0) { |
|
|
|
if (this.menu.length != 0) { |
|
|
|
clearInterval(this.timer) |
|
|
|
clearInterval(this.timer); |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.activeIndex) { |
|
|
|
if (this.activeIndex) { |
|
|
|
let tmp = this.menu.find(item => item.id == this.activeIndex) |
|
|
|
let tmp = this.menu.find(item => item.id == this.activeIndex); |
|
|
|
this.openMenu(tmp) |
|
|
|
this.openMenu(tmp); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (this.menu.length != 0) { |
|
|
|
if (this.menu.length != 0) { |
|
|
|
this.openMenu(this.menu[0]) |
|
|
|
this.openMenu(this.menu[0]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// this.$store.dispatch('GetTopMenu').then(res => { |
|
|
|
// this.$store.dispatch('GetTopMenu').then(res => { |
|
|
|
@ -146,9 +146,9 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
:deep(.el-menu--horizontal>.el-menu-item.is-active) { |
|
|
|
:deep(.el-menu--horizontal > .el-menu-item.is-active) { |
|
|
|
// background-color: #dceeff !important; |
|
|
|
|
|
|
|
border-bottom: none !important; |
|
|
|
border-bottom: none !important; |
|
|
|
|
|
|
|
background-color:rgba(235,241,251,0.6) !important; |
|
|
|
} |
|
|
|
} |
|
|
|
.custom-menu .el-menu-item.is-active { |
|
|
|
.custom-menu .el-menu-item.is-active { |
|
|
|
background-color: #ebf1fb !important; /* 修改选中项的背景色 */ |
|
|
|
background-color: #ebf1fb !important; /* 修改选中项的背景色 */ |
|
|
|
@ -157,18 +157,13 @@ export default { |
|
|
|
/* 如果需要修改选中时span标签的文字颜色,可以嵌套样式 */ |
|
|
|
/* 如果需要修改选中时span标签的文字颜色,可以嵌套样式 */ |
|
|
|
.el-menu-item.is-active span { |
|
|
|
.el-menu-item.is-active span { |
|
|
|
color: #fff !important; |
|
|
|
color: #fff !important; |
|
|
|
// color: #284c89 !important; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.el-menu-item.is-active i) { |
|
|
|
:deep(.el-menu-item.is-active i) { |
|
|
|
// color: #06f !important; |
|
|
|
|
|
|
|
color: #284c89 !important; |
|
|
|
color: #284c89 !important; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
:deep(.el-menu-item.is-active span) { |
|
|
|
:deep(.el-menu-item.is-active span) { |
|
|
|
// color: #06f !important; |
|
|
|
|
|
|
|
color: #284c89 !important; |
|
|
|
color: #284c89 !important; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
</style> |
|
|
|
</style> |