Commit b77602fe authored by pyang's avatar pyang

添加路由切换tab判断

parent d8fc4d7e
...@@ -3,14 +3,33 @@ ...@@ -3,14 +3,33 @@
<div class="nav"> <div class="nav">
<div class="logo">小云蜂巢</div> <div class="logo">小云蜂巢</div>
<ul class="menus"> <ul class="menus">
<li><a class="active" href="/content">内容管理工具</a></li> <li><a :class="current === 0 ? 'active' : ''" href="/content">内容管理工具</a></li>
<li><a href="/ads">广告交易平台</a></li> <li><a :class="current === 1 ? 'active' : ''" href="/ads">广告交易平台</a></li>
</ul> </ul>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
export default {
data () {
return {
current: 0
}
},
beforeMount () {
switch (location.pathname) {
case '/content':
this.current = 0
break
case '/ads':
this.current = 1
break
default:
this.current = 0
}
}
}
</script> </script>
<!-- Add "scoped" attribute to limit CSS to this component only --> <!-- Add "scoped" attribute to limit CSS to this component only -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment