游侠的博客 游侠的博客
首页
  • 论文笔记
  • 一些小知识点

    • pytorch、numpy、pandas函数简易解释
  • 《深度学习500问》
开发
技术
更多
关于
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

Ranger

一名在校研究生
首页
  • 论文笔记
  • 一些小知识点

    • pytorch、numpy、pandas函数简易解释
  • 《深度学习500问》
开发
技术
更多
关于
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • Vue

    • Vue Router

      • Vue Router入门
      • 动态路由匹配
      • 解决访问路径#问题
    • 创建应用实例
    • element-plus不使用index作为path在激活导航时进行默认的路由跳转
      • 问题描述
  • SpringBoot2

  • JavaWeb

  • SSM

  • SpringBoot3

  • 技术
  • Vue
yangzhixuan
2023-03-20
目录

element-plus不使用index作为path在激活导航时进行默认的路由跳转

# 问题描述

element-plus如何不使用index作为path在激活导航时进行默认的路由跳转?

示例如下:

<!--这里的default-active是页面初始化时选择的菜单子项的index,这里的值为string,
router指启用vue-router模式,启用该模式会在激活导航时以index作为path进行路由跳转,配合default-active来设置加载时的激活项-->
<el-menu default-active="1" router>
<!--这里-->
  <el-menu-item index="0">LOGO</el-menu-item>
  <div class="flex-grow" />
<!--这里item里的route接受的是一个路由对象,并需要使用v-bind进行绑定-->
  <el-menu-item index="1" :route="activeIndex">Easy Paste</el-menu-item>
  <el-menu-item index="2">Workspace</el-menu-item>
</el-menu>

<script>
export default {
  data() {
    return {
      // 这边其实是一个路由对象,和item中的route进行绑定
      activeIndex: this.$router.push('/paste')
    }
  }
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
编辑 (opens new window)
上次更新: 2024/05/30, 07:49:34
创建应用实例
各种小知识

← 创建应用实例 各种小知识→

最近更新
01
tensor比较大小函数
05-30
02
Large Language Models can Deliver Accurate and Interpretable Time Series Anomaly Detection
05-27
03
半监督学习经典方法 Π-model、Mean Teacher
04-10
更多文章>
Theme by Vdoing | Copyright © 2023-2024 Ranger | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式