nwscreen-ui/src/components/globalBar.vue

106 lines
2.2 KiB
Vue
Raw Normal View History

2024-09-06 11:14:31 +08:00
<template>
<div class="tit-cont">
<div class="inner-tit">
<div
v-for="item in titList"
:key="item.id"
:class="[ 'single-tit', { isActive: currentIndex === item.id } ]"
@click="changeTitle(item)"
>
<h4>
<span v-if="item.title !== null">{{ item.title }}</span>
<img
v-if="item.title !== null && currentIndex === item.id"
src="../assets/img/tit-bottom.png"
alt=""/>
<img
v-if="item.title !== null && currentIndex !== item.id"
src="../assets/img/title-nosel.png"
alt=""/>
</h4>
</div>
<!-- <div class="tit-cen"></div>
<div class="tit-rig">2</div>-->
</div>
</div>
</template>
<script>
export default {
name: 'globalBar',
props: {
indexCount: {
type: Number,
default: null
}
},
data() {
return {
titList: [
{ title: '首页', id: 1, path: '/Home/index' },
{ title: '变电', id: 2, path: '/substation/index' },
{ title: null, id: null },
{ title: null, id: null },
{ title: '线路', id: 3, path: '/line/index' },
{ title: '工作台', id: 4, path: '/workbench/index' },
2024-09-06 11:14:31 +08:00
],
currentIndex: this.indexCount
}
},
methods: {
changeTitle(val) {
// console.log(val, this.$router)
this.currentIndex = val.id
this.$router.push({
path: val.path
})
}
}
}
</script>
<style scoped lang="less">
.tit-cont{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 110px;
background: url(../assets/img/title.png) no-repeat center;
.inner-tit{
width: 100%;
height: 60px;
display: flex;
justify-content: space-around;
align-items: end;
.single-tit{
font-size: 22px;
width: 10%;
display: flex;
justify-content: space-around;
color: #ABB0B8;
cursor: pointer;
h4{
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
img{
width: 100%;
height: 12px;
}
}
}
.isActive{
color: #2859B4;
}
}
}
</style>