【发布时间】:2020-04-19 19:46:03
【问题描述】:
我有一个对象数组
listA = [
{ name : "Pink Floyd",
sequence : 1,
favSong : "Shine On You",
favMember :[
{artist : "Nick Mason"}
]},
{ name : "Guns and Roses",
sequence :2,
favSong : "November Rain",
favMember :[
{artist : "Slash"}
]},
{ name : "Led Zeppelin",
sequence :3,
favSong : "Stairway To heaven",
favMember :[
{artist : "Jimmy page"}
]},
]
我将它们显示为 UI 上的多个扩展面板。我想添加一个功能,我可以在其中拖动单个扩展面板并更改名称的显示顺序。我尝试使用 sortableJs,但我无法弄清楚。
这里是 HTML
<div>
<strong>My favorite bands in order : - </strong>
</div>
<hr />
<hr />
<div class="row mt-3">
<div class="nomarLR mt-1 float-left col-12" *ngFor="let x of listA;let i =index">
<mat-accordion multi="false" class="cus-accordion-style2 col-12" class="nomarLR nomarTB">
<mat-expansion-panel class="nomarLR nomarTB">
<mat-expansion-panel-header class="nomarLR nomarTB">
<mat-panel-title class="nomarLR nomarTB">
{{x.name}}
</mat-panel-title>
</mat-expansion-panel-header>
<div *ngFor="let y of listA">
<span *ngFor="let z of y.favMember"> {{z.artist}} </span>
</div>
</mat-expansion-panel>
</mat-accordion>
</div>
</div>
<!-- why is multi not working ??-->
谁能帮帮我。这是Stackblitz 此外,当用户移动扩展面板时,它应该将数组对象推送到具有更新顺序的不同数组中。
【问题讨论】:
-
我喜欢你数组的内容。
-
谢谢。摇滚乐是爱。有什么解决办法吗?
-
遗憾的是,我没有任何线索。不过祝你好运..
-
你帮了我很多,新年快乐:)
-
新年快乐!
标签: html angular typescript user-interface material-design