Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Element Plus UI: No open to new tab for menu item

I have created a horizontal menu for Element Plus UI on Vue. When I right click on a menu item, I do not have the option to open it in a new tab.

No open to a new tab option

But when on the element plus documentation. When I right click on a menu item I have that option:

Right Click menu option

How do I achieve that functionality since I can't find any references on that on the documentation?

Menu Code:

<template>
  <el-menu
    class="sideMenu"
    :collapse="isCollapse"
    active-text-color="#409EFF"
    :default-active="activeLink"
    text-color="#909399"
    background-color="#FFFFFF"
    :router="true"
  >
    <el-menu-item index="/menu1">
      <el-icon><DocumentChecked /></el-icon>
      <span>Menu 1</span>
    </el-menu-item>

    <el-menu-item index="/menu2">
      <el-icon><DocumentChecked /></el-icon>
      <span>Menu 2</span>
    </el-menu-item>
  </el-menu>
</template>
like image 692
Nate Avatar asked Sep 17 '25 20:09

Nate


1 Answers

According to Element Plus documentation el-menu-item has an attribute of route: which is type Obj. So, the el-menu-item class would be like:

<el-menu-item index="/menu1" route= VUE-ROUTER-OBJ>

Or You can use the menu attribute which activates routing from the index value of menu-items:

<!DOCTYPE html>
<el-menu
    :default-active="activeIndex"
    class="el-menu-demo"
    mode="horizontal"
    @select="handleSelect"
    router= true 
  >
<!-- router is the key attribute-->


<el-menu-item index="/" route="/"> Home </el-menu-item>

<el-menu-item index="PATH OF VUE ROUTER"> LINK NAME </el-menu-item>
like image 151
Lagamura Avatar answered Sep 19 '25 11:09

Lagamura