From 9203acc5eb99221d7d803517e2dca334c7ebdaa4 Mon Sep 17 00:00:00 2001 From: Apple <> Date: Thu, 16 Jun 2022 14:22:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E8=90=A5=E9=94=80=E7=B3=BB?= =?UTF-8?q?=E7=BB=9FC=E7=AB=AF=E7=99=BD=E5=90=8D=E5=8D=95=E6=A0=B9?= =?UTF-8?q?=E6=8D=AEtoken=E6=9F=A5=E8=AF=A2=E5=95=86=E5=93=81=E7=BB=84?= =?UTF-8?q?=E8=A3=85=E5=95=86=E5=93=81=E9=9B=86=E5=90=88=EF=BC=8C=E6=8C=89?= =?UTF-8?q?=E7=85=A7=E5=95=86=E5=93=81=E6=9D=83=E9=87=8D=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=98=BE=E7=A4=BA=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- homepage.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/homepage.html b/homepage.html index 69167b2..c8f8969 100644 --- a/homepage.html +++ b/homepage.html @@ -310,6 +310,17 @@ }) goodsArr.push(obj); }); + /*商品自定义排序:0-100,降序排列,100第一个展示,0最后一个展示*/ + var objectArraySort =(keyName)=>{ + return (objectN, objectM)=>{ + var valueN = objectN[keyName] + var valueM = objectM[keyName] + if (valueN < valueM) return 1 + else if (valueN > valueM) return -1 + else return 0 + } + } + goodsArr.sort(objectArraySort('weight')) self.swiperDataList = goodsArr; self.goodsShow = goodsArr.length > 1; sessionStorage.setItem('goodsCount', goodsArr.length);