简体   繁体   English

当我使用 Material UI CSS 语法在 hover 上方时,如何使删除图标(菜单项中的子组件)出现?

[英]How to make the delete icon, which is child component in the Menu Item appear when I hover over it with Material UI CSS syntax?

I want to make the delete icon appear whenever I hover over the menu item, which is mapped over using the map function.每当我在菜单项上使用 hover 时,我想让删除图标出现,该菜单项是使用 map function 映射的。 The idea is that when I hover over the Menu Item, the delete icon should be visible on the corresponding menu item which it is mapped to.这个想法是,当我在菜单项上 hover 时,删除图标应该在它映射到的相应菜单项上可见。 I have tried using the material css way of doing doing this, not sure if i am doing so correctly because it is not showing.我试过使用材料 css 这样做,不确定我这样做是否正确,因为它没有显示。 Please see my code and let me know if there are any advices that you can give me about it.请查看我的代码,如果有任何建议可以告诉我,请告诉我。 Thanks!谢谢!

Hi I tried giving the icon a class name and was able to show the icon on hover.嗨,我尝试为该图标指定一个 class 名称,并且能够在 hover 上显示该图标。 Example . 例子 I just gave the className as a string instead of the material ui css way.我只是将 className 作为字符串而不是材料 ui css 方式给出。 Not sure why but sometimes I get issues giving pseudo class to child elements.不知道为什么,但有时我会遇到给子元素提供伪 class 的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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