Element + vue 导航栏滑块改版+

本文介绍了如何在使用Element UI和Vue的项目中,将导航栏的滑块效果改为跟随鼠标移动。通过详细阐述问题解决过程,分享了实现这一功能的代码片段。
摘要由CSDN通过智能技术生成
Element + vue 导航栏滑块改版+

项目中使用了elementui+vue的导航栏模块,需要做到底部滑块跟随鼠标效果,经反复思考及bug修改得以下代码:

<template>
  <div class="y-nav">
    <el-row class="nav">
      <!-- 将default-active绑定到dfactive上 -->
      <el-menu
        :default-active="dfactive"
        class="el-menu-demo"
        mode="horizontal"
        @select="handleSelect"
        text-color="#fff"
      >
        <!-- elemtntui中使用:default-active="dfactive"的值与index值作比较,相同的值给当前el-menu-item赋予.is-active,当前的导航块可循环出来 -->
        < index="index">
          <router-link
            to="/"
            @mouseover.native="itransition($event )"
            @mouseout.native="outtransition($event)"
          >首页</router-link>
        </el-menu-item>
        <el-menu-item index="leaderboard">
          <router-link
            :to="{name:'leaderboard'}"
            @mouseover.native="itransition($event )"
            @mouseout.native="outtransition($event)"
          >排行榜</router-link>
        </el-menu-item>
        <el-menu-item index="library">
 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值