如何自定义 React material 菜单行为
how to customise react material menu behaviour
我有一个设置按钮,点击它应该会显示一个锚定在设置按钮右侧的菜单,如图所示
因为 React material menu 会做同样的工作,我使用下面的菜单
<StyledMenu
id="customized-menu"
anchorEl={anchorEl}
keepMounted
open={Boolean(anchorEl)}
onClose={handleClose}>
<StyledMenuItem>
<div style={{ width: '70%', fontSize: '14px', padding: '5px' }}>
<div>
<img src={props.icon} alt='' style={{ width: '18px', height: '18px', }}></img>
Brigthness
</div>
<div><Slider value={value ? value : 30} onChange={handleChange} aria-labelledby="continuous-slider" /></div>
</div>
<div style={{ width: '30%', padding: '5px' }}>
<div>Reset</div>
<div><input style={{width:'20px',height:'20px'}} text="om" /></div>
</div>
</StyledMenuItem>
</StyledMenu>
问题
- 无法平滑滑动,因为当我单击滑块菜单时将充当按钮
- 如何禁用菜单按钮行为
我有一个设置按钮,点击它应该会显示一个锚定在设置按钮右侧的菜单,如图所示
因为 React material menu 会做同样的工作,我使用下面的菜单
<StyledMenu
id="customized-menu"
anchorEl={anchorEl}
keepMounted
open={Boolean(anchorEl)}
onClose={handleClose}>
<StyledMenuItem>
<div style={{ width: '70%', fontSize: '14px', padding: '5px' }}>
<div>
<img src={props.icon} alt='' style={{ width: '18px', height: '18px', }}></img>
Brigthness
</div>
<div><Slider value={value ? value : 30} onChange={handleChange} aria-labelledby="continuous-slider" /></div>
</div>
<div style={{ width: '30%', padding: '5px' }}>
<div>Reset</div>
<div><input style={{width:'20px',height:'20px'}} text="om" /></div>
</div>
</StyledMenuItem>
</StyledMenu>
问题
- 无法平滑滑动,因为当我单击滑块菜单时将充当按钮
- 如何禁用菜单按钮行为