2024-03-12 18:53:51 +08:00
|
|
|
import './menu-with-top-button.css'
|
|
|
|
import {IMenuWithTopButton} from "../../interfaces/menu/IMenuWithTopButton.ts";
|
|
|
|
|
|
|
|
export default function MenuWithTopButton(props: IMenuWithTopButton) {
|
|
|
|
const list = props.list.map((item, index) => (
|
2024-04-28 11:04:03 +08:00
|
|
|
// 创建项目下三个选项
|
2024-04-01 20:39:22 +08:00
|
|
|
<li className={item.active ? 'active' : ''} key={item.id} onClick={(e) => {
|
2024-03-12 18:53:51 +08:00
|
|
|
props.handleListItem(e, index, item);
|
|
|
|
}}>
|
2024-03-16 23:12:49 +08:00
|
|
|
{item.icon ? (<img src={item.icon} className="menu-icon" alt="加载失败"/>) : <></>}
|
2024-03-12 18:53:51 +08:00
|
|
|
<span className="menu-name">{item.name}</span>
|
|
|
|
</li>
|
|
|
|
));
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="menu-with-top-button">
|
2024-04-28 11:04:03 +08:00
|
|
|
{/* button 是三个黄色按钮 */}
|
2024-03-16 23:12:49 +08:00
|
|
|
<button className="btn btn-orange top-button"
|
2024-03-12 18:53:51 +08:00
|
|
|
onClick={(e) => {
|
|
|
|
props.button.handle(e);
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{props.button.name}
|
|
|
|
</button>
|
|
|
|
<ul>{list}</ul>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|