| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <template>
- <div class="header">
- <div class="con">
- <a href="https://www.4dkankan.com/" class="logo">
- <img :src="require('@/assets/images/icons/logo_black.svg')" alt="" />
- </a>
- <ul class="tab">
- <li @click="handleItem(item)" :class="{active:active.id==item.id}" v-for="(item, i) in tab" :key="i">
- {{ item.name }}
- </li>
- </ul>
- <user-info class="user-info"></user-info>
- </div>
- </div>
- </template>
- <script>
- import UserInfo from "@/components/userInfo.vue";
- export default {
- components: {
- UserInfo,
- },
- data() {
- return {
- active:{},
- tab: [
- {
- name: "我的作品",
- id: "works",
- path:{
- path:'/works'
- }
- },
- {
- name: "我的素材",
- id: "material",
- path:{
- path:'/'
- }
- }
- ],
- };
- },
- watch:{
- '$route.meta':{
- deep:true,
- handler:function (newVal) {
- this.active = this.tab.find(item=>{
- return item.id == newVal.belong
- })
- }
- }
- },
- methods:{
- handleItem(item){
- this.$router.push(item.path)
- }
- }
- };
- </script>
- <style lang="less" scoped>
- .header {
- width: 100%;
- background: #fff;
- position: fixed;
- top: 0;
- left: 0;
- z-index: 999;
- .con {
- color: #000;
- max-width: 1280px;
- height: 70px;
- display: flex;
- align-items: center;
- margin: 0 auto;
- position: relative;
- padding: 0;
- .logo {
- font-size: 24px;
- font-weight: bold;
- height: 100%;
- >img{
- height: 100%;
- vertical-align: middle;
- }
- }
- .tab {
- display: flex;
- align-items: center;
- margin-left: 116px;
- > li {
- cursor: pointer;
- margin-right: 50px;
- text-align: left;
- font-size: 16px;
- color: #909090;
- &.active{
- font-size: 16px;
- font-weight: bold;
- color: #0076F6;
- position: relative;
- &::before{
- content: '';
- width: 20px;
- height: 2px;
- background: #0076F6;
- display: inline-block;
- position: absolute;
- left: 50%;
- transform: translateX(-50%);
- bottom: -10px;
- }
- }
- }
- }
- .user-info {
- margin-left: auto;
- margin-right: 0;
- }
- }
- }
- </style>
|