pc端 大屏可视化中的导航栏的应用

<template>
  <div>
    <ul>
      <li
        :class="tagName === 'keywordAnalysis' ? 'current' : ''"
        @click="setTagname('keywordAnalysis')"
      >
        关键词分析
      </li>
      <li
        :class="tagName === 'cooperationTrend' ? 'current' : ''"
        @click="setTagname('cooperationTrend')"
      >
        合作热点趋势
      </li>
      <li
        :class="tagName === 'keyWord' ? 'current' : ''"
        @click="setTagname('keyWord')"
      >
        热词共现图谱
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tagName: "",
    };
  },
  methods: {
    setTagname(item) {
      this.tagName = item;
    },
  },
};
</script>

<style>
    div {
    background: #f1f4f9;
    height: 65px;
    line-height: 65px;
    font-family: "PingFang SC-Light";
    }
    ul li {
    list-style: none;
    }
    ul {
    display: flex;
    display: flex;
    justify-content: space-between;
    }
    li {
    font-size: 20px;
    color: #262626;
    }
    .current {
    font-size: 20px;
    cursor: pointer;
    margin-top: 6px;
    height: 53px;
    line-height: 53px;
    border-radius: 8px;
    background: #fff;
    color: #2f47a1;
    padding: 0 27px;
    }
</style>

总结:若导航栏中有多个li,给一个点击事件传入相应的参数,把这个参数传data中的一个变量,

利用data中的变量判断,若点击它,就添加需求中所需要的样式

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值