|
| 1 | +<template> |
| 2 | +<div id="navigationbar"> |
| 3 | + <nav class="navbar navbar-default"> |
| 4 | + |
| 5 | + <div class="container"> |
| 6 | + |
| 7 | + <div class="navbar-header"> |
| 8 | + <!-- <div class="container"> --> |
| 9 | + <button type="button" class="navbar-toggle collapsed" @click="showNavbar=!showNavbar"> |
| 10 | + <span class="sr-only">Toggle navigation</span> |
| 11 | + <span class="icon-bar"></span> |
| 12 | + <span class="icon-bar"></span> |
| 13 | + <span class="icon-bar"></span> |
| 14 | + </button> |
| 15 | + <router-link to="/" class="navbar-brand" role="button" style="color: #777; background-color: transparent;">[@] ObjC 中国</router-link> |
| 16 | + </div> |
| 17 | + <collapse class="navbar-collapse text-align" v-model="showNavbar"> |
| 18 | + <ul class="nav navbar-nav"> |
| 19 | + <li> |
| 20 | + <router-link to="/issues">期刊</router-link> |
| 21 | + </li> |
| 22 | + <li> |
| 23 | + <router-link to="/products">书籍</router-link> |
| 24 | + </li> |
| 25 | + <li> |
| 26 | + <router-link to="/goodscart" v-show="this.$store.state.user.isLogin">购物车</router-link> |
| 27 | + </li> |
| 28 | + </ul> |
| 29 | + |
| 30 | + <ul class="nav navbar-nav navbar-right"> |
| 31 | + <li><a class="iconstyle" style="padding-bottom:10px;color: #777; background-color: transparent;"><iframe frameborder="0" height="20px" scrolling="0" src="https://ghbtns.com/github-btn.html?user=halfrost&repo=Halfrost-Field&type=star&count=true&" width="100px"></iframe></a></li> |
| 32 | + |
| 33 | + <transition name=fade> |
| 34 | + <li> |
| 35 | + <router-link to="" v-show="this.$store.state.user.isLogin" style="padding-bottom:10px;color: #777; background-color: transparent;">{{this.$store.state.user.email}}</router-link> |
| 36 | + </li> |
| 37 | + </transition> |
| 38 | + |
| 39 | + <transition name=fade> |
| 40 | + <li><a @click="logout" v-show="this.$store.state.user.isLogin">注销 <span class="glyphicon glyphicon-log-out"></span></a></li> |
| 41 | + </transition> |
| 42 | + |
| 43 | + <transition name=fade> |
| 44 | + <li> |
| 45 | + <router-link to="/login" v-show="!this.$store.state.user.isLogin"><span class="glyphicon glyphicon-log-in"></span> 登录</router-link> |
| 46 | + </li> |
| 47 | + </transition> |
| 48 | + </ul> |
| 49 | + </collapse> |
| 50 | + </div> |
| 51 | + </nav> |
| 52 | +</div> |
| 53 | +</template> |
| 54 | + |
| 55 | +<script> |
| 56 | +
|
| 57 | +export default { |
| 58 | + props: [], |
| 59 | + data() { |
| 60 | + return { |
| 61 | + showNavbar: false |
| 62 | + } |
| 63 | + }, |
| 64 | + methods: { |
| 65 | + logout() { |
| 66 | + this.$store.commit('userLogout') |
| 67 | + }, |
| 68 | + getUserLoginState() { |
| 69 | + return this.$store.state.user.isLogin |
| 70 | + } |
| 71 | + }, |
| 72 | + created() { |
| 73 | + } |
| 74 | +} |
| 75 | +</script> |
| 76 | + |
| 77 | +<style > |
| 78 | +.iconstyle { |
| 79 | + padding-bottom: 10px; |
| 80 | + margin-right: 0px; |
| 81 | + color: #777; |
| 82 | +} |
| 83 | +
|
| 84 | +.active-disable>.router-link-active { |
| 85 | + color: #777; |
| 86 | +} |
| 87 | +
|
| 88 | +.router-link-active { |
| 89 | + color: #555; |
| 90 | + background-color: #e7e7e7; |
| 91 | +} |
| 92 | +
|
| 93 | +.navbar-default .navbar-nav>li>a:focus, |
| 94 | +.navbar-default .navbar-nav>li>a:hover { |
| 95 | + color: #555; |
| 96 | + background-color: #e7e7e7; |
| 97 | +} |
| 98 | +</style> |
0 commit comments