简体   繁体   中英

Right click on Collapsed Menu Item of Ant Design do not show "Open in new tab"

I have a React App that use Ant Design. It uses the Ant Design Menu component, in collapsed mode.

The thing is when I try to right click on a menu item, it do not show the options to "Open in new tab/window".

I suspect that it has relation with this question , because when I use the code inspector, the collapsed menu item of Ant Design don't use a tags directly.

How can I achieve that the "Open in new tab/window" options of right click appears when I click on collapsed menu items of Ant Design???

EDIT

The code I have is pretty like this:

<Menu.Item
    key="menu_1"
    onClick={() => {
        window.location.href = '../path/to/route';
    }}
>
    Dashboard
</Menu.Item>

But my application has more than 30 menu items, so putting an a tag on each item is a solution that require many text. I want to apply a dynamic solution in execution time for this issue.

You can always add anchor tag wherever you want. Like in Collapsed inline menu , you can use as follows:

<Menu.Item key="3">
    <Icon type="inbox" />
    <span>
        <a href="#">Option 3</a>
    </span>
</Menu.Item>

I have created a working demo , please check.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM