From 405c7232287955f3c28c3cb29fa2e2999fc4016b Mon Sep 17 00:00:00 2001 From: deartibers <947466799@qq.com> Date: Thu, 7 Jul 2022 11:25:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E6=B3=A8=E6=8C=89id=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipmentWarehouse/components/remarksModal.jsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/remarksModal.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/remarksModal.jsx index 34dabf1..a04369d 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/remarksModal.jsx +++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/remarksModal.jsx @@ -21,13 +21,16 @@ function remarksModal (props) { //初始化 useEffect(() => { let myScrollList=ScrollList - for (let index = 0; index < cameraRemarks.length; index++) { - myScrollList[index].value=cameraRemarks[index].remark + let sortCameraRemarks =cameraRemarks//排序 + sortCameraRemarks.sort((a,b)=>{return a.id-b.id}) + + for (let index = 0; index < sortCameraRemarks.length; index++) { + myScrollList[index].value=sortCameraRemarks[index].remark } setScrollList(myScrollList) let mycameraRemarks=[] - for (let index = 0; index < cameraRemarks.length; index++) { - mycameraRemarks.push(cameraRemarks[index].remark) + for (let index = 0; index < sortCameraRemarks.length; index++) { + mycameraRemarks.push(sortCameraRemarks[index].remark) } setShowScrollList(mycameraRemarks) }, []);