浏览代码

changeFloor方法修改

unknown 4 年之前
父节点
当前提交
7c1495a0e2
共有 1 个文件被更改,包括 15 次插入9 次删除
  1. 15 9
      src/components/floorList.vue

+ 15 - 9
src/components/floorList.vue

@@ -76,19 +76,23 @@ export default {
             console.log(this.floorIdArr)
             const len = this.floorIdArr.length
             let index = this.floorIdArr.findIndex(item => item === this.currentFloorId)
-            console.log(index)
-
-            if (flag) {
-                this.currentFloorId = this.floorIdArr[index--]
-            } else {
-                this.currentFloorId = this.floorIdArr[index++]
+            console.log('---------------index:', index, '--------------')
+            if (flag === 1) {
+                index--
+                this.currentFloorId = this.floorIdArr[index]
+            } else if (flag === -1) {
+                index++
+                this.currentFloorId = this.floorIdArr[index]
             }
-            console.log(this.currentFloorId)
-
+            // 最上最下处理
             if (index === 0) {
+                this.currentFloorId = this.floorIdArr[0]
+                console.log('currentFloorId', this.currentFloorId)
                 this.showT = false
                 this.showB = true
             } else if (index === len - 1) {
+                this.currentFloorId = this.floorIdArr[len - 1]
+                console.log('currentFloorId', this.currentFloorId)
                 this.showT = true
                 this.showB = false
             }
@@ -167,7 +171,7 @@ export default {
         text-align: center;
         .floor-out {
             height: 160px;
-            height: 290px;
+            height: 312px;
             //TODO:
             overflow: hidden;
             // overflow-y: auto;
@@ -177,6 +181,8 @@ export default {
             // }
 
             .floor-center {
+                // TODO:
+                margin-top: 0 !important;
                 .floor-item {
                     width: 36px;
                     height: 32px;