let chapter=[
{id: 792, courseId: 95, type: "lesson", number: 1, seq: 2, parentChapterId: 0, title: "1",…},
{id: 794, courseId: 95, type: "lesson", number: 2, seq: 3, parentChapterId: 0, title: "2-1",…},
{id: 793, courseId: 95, type: "chapter", number: 1, seq: 4, parentChapterId: 0, title: "2",…},
{id: 800, courseId: 95, type: "chapter", number: 2, seq: 1, parentChapterId: 0, title: "我是第二章",…}
]
//数组对象的属性进行排序
compare(property) {
return function (obj1, obj2) {
let o1 = obj1[property];
let o2 = obj2[property];
return o1 - o2;
};
}
//排序时
this.compare('seq')
12-06
149
07-13
1463
05-27