SOURCE

//js
function compare(property){
    return function(a,b){
        var value1 = a[property];
        var value2 = b[property];
        return value1=value2;
    }
}
var imageList = new Array();

var item1 = {};
item1.Tags="样品照片";
item1.Path="/Storage";
var item2 = {};
item2.Tags="耐久标照片";
item2.Path="/Storage";
var item3 = {};
item3.Tags="吊牌照片";
item3.Path="/Storage";
var item4 = {};
item4.Tags="封样照片";
item4.Path="/Storage";
imageList.push(item4);
imageList.push(item2);
imageList.push(item3);
imageList.push(item1);

var tagedImages = new Array();
for(let i = 0;i<imageList.length;i++){
    if(imageList[i].Tags=="样品照片"){
        imageList[i].SortId=1;
        tagedImages.push(imageList[i]);
    }
    if(imageList[i].Tags=="耐久标照片"){
        imageList[i].SortId=2;
        tagedImages.push(imageList[i]);
    }
    if(imageList[i].Tags=="吊牌照片"){
        imageList[i].SortId=3;
        tagedImages.push(imageList[i]);
    }
    if(imageList[i].Tags=="封样照片"){
        imageList[i].SortId=4;
        tagedImages.push(imageList[i]);
    }
    
}
tagedImages.sort(compare("SortId"));
//排序
for(let i = 0;i<tagedImages.length;i++){
    console.log(tagedImages[i].SortId);
}
console.log(tagedImages.length);
if(tagedImages.length<1){
  //current.Delete();
}else{
pic=tagedImages.shift();
//current.SetImage(pic.Path);
console.log(pic.Path);
}
console 命令行工具 X clear

                    
>
console