feat: sort left area item to #33031381

This commit is contained in:
wanying.jwy 2021-02-22 15:03:06 +08:00
parent b20238a4fd
commit 1ab33655db

View File

@ -25,7 +25,11 @@ class Contents extends Component<{ area: Area }> {
const { area } = this.props;
const top: any[] = [];
const bottom: any[] = [];
area.container.items.forEach((item) => {
area.container.items.sort((a, b) => {
const index1 = a.config?.index || 0;
const index2 = b.config?.index || 0;
return index1 === index2 ? 0 : (index1 > index2 ? 1 : -1);
}).forEach((item) => {
const content = <div key={`left-area-${item.name}`}>{item.content}</div>;
if (item.align === 'bottom') {
bottom.push(content);