sortType(){
var data=[{
pic:'20181119.png',
picsBack:'desc=财富自由可以type=4',
picsDesc:'财富自由'
},{
pic:'20181115.png',
picsBack:'desc=需要买房type=1',
picsDesc:'购房规划'
},{
pic:'20181118.png',
picsBack:'desc=不断的把财富变财富type=3',
picsDesc:'财富增值'
},{
pic:'20181116.png',
picsBack:'desc=提升自己的见识type=2',
picsDesc:'教育规划'
}]
const arrsort = [];
data.forEach((item,index)=>{
let objsort = item
for(var value in objsort){
objsort.pic = objsort.pic
objsort.explain = objsort.picsBack.match(/desc=(S*)type/)[1];
objsort.type = objsort.picsBack.match(/type=(S*)/)[1];
objsort.picsDesc = objsort.picsDesc
}
arrsort.push(objsort)
})
arrsort.sort(this.type);
console.log(arrsort);
},
type(a,b){
return a.type-b.type
},
截取picsBack的里面的type排序;
打印出来