You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
131 lines
3.2 KiB
131 lines
3.2 KiB
<!--
|
|
* @Author: wally
|
|
* @email: 18603454788@163.com
|
|
* @Date: 2021-01-13 17:25:56
|
|
* @LastEditors: wally
|
|
* @LastEditTime: 2021-01-15 17:38:59
|
|
-->
|
|
<template>
|
|
<div class="nav-box">
|
|
<div v-for="(item, index) in list" :key="index">
|
|
<div
|
|
v-if="index !== 0"
|
|
:class="activeNum === index ? 'nav-item-active' : 'nav-item'"
|
|
@click="jump(item.url, index)"
|
|
class="d-flex flex-column justify-center"
|
|
v-dompurify-html="item.title"
|
|
>
|
|
<!-- {{ item.title }} -->
|
|
</div>
|
|
<div
|
|
v-else
|
|
class="d-flex flex-column justify-center nav-title"
|
|
:class="activeNum === index ? 'nav-item-active' : ''"
|
|
@click="jump(item.url, index)"
|
|
v-dompurify-html="item.title"
|
|
></div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'LeftNav',
|
|
data() {
|
|
return {
|
|
str: '导航条',
|
|
activeNum: 0,
|
|
list: [
|
|
{
|
|
title: '创时代孵化器',
|
|
url: '/Hatch/Epoch',
|
|
},
|
|
{
|
|
title: '高新众创空间',
|
|
url: '/Hatch/Space',
|
|
},
|
|
{
|
|
title: '数智创时代' + '<br />' + '专业孵化器',
|
|
url: '/Hatch/Incubator',
|
|
},
|
|
{
|
|
title: '线上孵化器',
|
|
url: '/Hatch/Fictitious',
|
|
},
|
|
{
|
|
title: '创新创业服务',
|
|
url: '/Hatch/Service',
|
|
},
|
|
{
|
|
title: '创业导师',
|
|
url: '/Hatch/Tutor',
|
|
},
|
|
{
|
|
title: '合作伙伴',
|
|
url: '/Hatch/Partner',
|
|
},
|
|
],
|
|
};
|
|
},
|
|
watch: {
|
|
$route(to, from) {
|
|
// console.log(from.path,to.path);
|
|
if (to.path === '/Hatch/Space') {
|
|
this.activeNum = 1;
|
|
} else if (to.path === '/Hatch/Incubator') {
|
|
this.activeNum = 2;
|
|
} else if (to.path === '/Hatch/Fictitious') {
|
|
this.activeNum = 3;
|
|
} else if (to.path === '/Hatch/Tutor') {
|
|
this.activeNum = 5;
|
|
} else if (to.path === '/Hatch/Partner') {
|
|
this.activeNum = 6;
|
|
} else if (to.path === '/Hatch/Service') {
|
|
this.activeNum = 4;
|
|
} else {
|
|
this.activeNum = 0;
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
if (this.$route.fullPath === '/Hatch/Space') {
|
|
this.activeNum = 1;
|
|
} else if (this.$route.fullPath === '/Hatch/Incubator') {
|
|
this.activeNum = 2;
|
|
} else if (this.$route.fullPath === '/Hatch/Fictitious') {
|
|
this.activeNum = 3;
|
|
} else if (this.$route.fullPath === '/Hatch/Tutor') {
|
|
this.activeNum = 5;
|
|
} else if (this.$route.fullPath === '/Hatch/Partner') {
|
|
this.activeNum = 6;
|
|
} else if (this.$route.fullPath === '/Hatch/Service') {
|
|
this.activeNum = 4;
|
|
} else {
|
|
this.activeNum = 0;
|
|
}
|
|
},
|
|
methods: {
|
|
jump(url, index) {
|
|
if (this.$route.fullPath === url) {
|
|
this.$message.success('已在当前界面');
|
|
} else {
|
|
this.$router.push(url);
|
|
this.activeNum = index;
|
|
}
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="stylus">
|
|
.nav-title {
|
|
height: 80px;
|
|
// line-height: 80px;
|
|
cursor: pointer;
|
|
background: #fff;
|
|
font-size: 24px;
|
|
margin: 0 4px 6px 0;
|
|
text-align: center;
|
|
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
|
|
}
|
|
</style>
|
|
|