瀏覽代碼

列表设置最大高度

natasha 1 月之前
父節點
當前提交
ea02be2798
共有 1 個文件被更改,包括 10 次插入1 次删除
  1. 10 1
      src/views/courseList.vue

+ 10 - 1
src/views/courseList.vue

@@ -24,6 +24,7 @@
           class="search-form"
           ref="form"
           style="margin-left: 10px"
+          id="search-form"
         >
           <el-form-item>
             <el-form-item
@@ -70,13 +71,15 @@
             >
           </el-form-item>
         </el-form>
-        <div class="table-box">
+        <div class="table-box" :style="{ height: tableHeight + 'px' }">
           <el-table
             v-loading="tableloading"
             :data="tableData"
             style="width: 100%"
             @sort-change="handleSort"
             :default-sort="dataSort"
+            :max-height="tableHeight + 'px'"
+            v-if="tableHeight"
           >
             <el-table-column
               class="table-firstC"
@@ -593,6 +596,7 @@ export default {
       dataSort: localStorage.getItem("dataSort")
         ? JSON.parse(localStorage.getItem("dataSort"))
         : {},
+      tableHeight: 0,
     };
   },
   mounted() {
@@ -607,6 +611,10 @@ export default {
     //   "scroll",
     //   this.selectScroll
     // );
+    this.tableHeight =
+      window.innerHeight -
+      document.getElementById("search-form").clientHeight -
+      200;
   },
   computed: {
     url() {
@@ -1217,6 +1225,7 @@ export default {
     background: #fff;
     padding: 10px 32px 0 32px;
     border-radius: 4px;
+    margin-bottom: 10px;
   }
 }
 </style>