| | |
| | | }) |
| | | return |
| | | } |
| | | } else if (item.component === 'navbar') { |
| | | if (cards.filter(card => card.type === 'navbar').length > 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单栏不可重复添加!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | } else if (item.component === 'topbar') { |
| | | if (cards.filter(card => card.type === 'topbar').length > 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '导航栏不可重复添加!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | let name = '' |
| | |
| | | } |
| | | |
| | | const { index: overIndex } = findCard(`${targetId}`) |
| | | const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] }) |
| | | let _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] }) |
| | | let Topbar = null |
| | | let Navbar = null |
| | | _cards = _cards.filter(item => { |
| | | if (item.type === 'topbar') { |
| | | Topbar = item |
| | | } else if (item.type === 'navbar') { |
| | | Navbar = item |
| | | } |
| | | |
| | | return item.type !== 'topbar' && item.type !== 'navbar' |
| | | }) |
| | | |
| | | if (Topbar) { |
| | | _cards.unshift(Topbar) |
| | | } |
| | | if (Navbar) { |
| | | _cards.push(Navbar) |
| | | } |
| | | |
| | | handleList({...menu, components: _cards}) |
| | | setCards(_cards) |
| | |
| | | }) |
| | | |
| | | return ( |
| | | <div ref={drop} className="mob-shell-inner" id="menu-shell-inner" style={menu.style}> |
| | | <div className="ant-row"> |
| | | <div ref={drop} className="mob-shell-inner" id="menu-shell-inner"> |
| | | <div className="ant-row" style={menu.style}> |
| | | {cards.map(card => ( |
| | | <Card |
| | | id={card.uuid} |