list= [ { id: '0', seq: '0' }, {
id: '1', seq: '1' }, { id: '2', seq: '2' } { id: '3', seq: '3' }
] swapItems(list, i, index1) { list[i] = list.splice(index1, 1, list[i])[0]; list.forEach((item, num, arr) => { item.seq = num; }); return list; } upRecord(item, code) { if (code === 'normal') { if (item.seq === 0) { toastr.warning('当前为第一行无法上移'); } else { this.swapItems(this.list, item.seq, item.seq - 1); } } if (code === 'top') { if (item.seq === 0) { toastr.warning('当前为第一行无法置顶'); } else { this.swapItems(this.list, it
Angular下实现Array数组的上移,下移,置顶,置低,+序号修改
最新推荐文章于 2022-01-16 21:26:21 发布