Skip to content

如何配置menu菜单某一个页面target="_blank"新窗口打开 #7

Discussion options

You must be logged in to vote

有两种比较简单的方法

  1. 用前端 js 实现
document.querySelector('.menu-item-admin a').target = '_blank';
  1. 在渲染阶段修改
    在这一行代码
    return htmlTag(tag, attrs, decodeURI(text), false);

    之前加上一行
if (path === '/admin/') attrs.target = '_blank';

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by stevenjoezhang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #7 on December 12, 2020 09:30.