阅读 112

desc是升序还是降序,js数组sort升序降序

//html divid=' test ' input type=' text ' placeholder='关键字' v-model=' searchname '/ulliv-for=' (索引) index ----- { p.age }/Li/ul button @ click button button @ click=' set ordertype (2) '年龄降序/button button @ click=' set orde divscriptsrc=avascript ' charset=' utf-8 '/script//jsscriptnewvue (El : ' # test ),data: ) persons: ) age:11}、{name:'Timi ',age:23}、{name3360'XBC ',age33609}} 1为升序,2为降序,1 },computed : { filted } ordertype }=this console.log (this ) console.log ) searchname (console.log ) persons ) console.log (ordertype )/==-1排序if(ordertype!==0) ) fpersons.sort(function(p1,p2 ) ) /在负数P1之前,将正数p2返回到之前//1表示升序,表示2降序if (ordertype==2) returnp

文章分类
代码人生
版权声明:本站是系统测试站点,无实际运营。本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 XXXXXXo@163.com 举报,一经查实,本站将立刻删除。
相关推荐