//数组排序
function sortNumber(a,b){
return a-b
}
//数组对象方法排序:
function sortByKey(a,b){
return b.age-a.age
}
var app=new Vue({
el:"#app",
data:{
items:[11,42,3,44,332,552,52234,12],
students:[{name:'jspang',age:322},{name:'Panda',age:30},{name:'PanPaN',age:21},{name:'King',age:45}]
},computed:{
sortitems:function(){
return this.items.sort(sortNumber);
},
sortByStudent:function(){
return this.students.sort(sortByKey)
}
}
})