6565 <el-col :span =" 3" ></el-col >
6666 </el-row >
6767 </div >
68- <!-- <div class="operation-item">
68+ <!-- <div class="operation-item">
6969 <el-row :gutter="20">
7070 <el-col :span="3"></el-col>
7171 <el-col :span="3"></el-col>
@@ -126,6 +126,7 @@ export default {
126126 // ---------------table options---------------
127127 sourceData: [],
128128 tableData: [],
129+ scrollStartIndex: 0 ,
129130 // filter condition
130131 filterConditions: [],
131132 cellStyleOption: {
@@ -137,7 +138,8 @@ export default {
137138 },
138139 virtualScrollOption: {
139140 // 是否开启
140- enable: true
141+ enable: true ,
142+ scrolling: this .scrolling
141143 },
142144 sortOption: {
143145 sortChange : params => {
@@ -221,9 +223,7 @@ export default {
221223 title: " #" ,
222224 width: 30 ,
223225 fixed: this .enableColumnFixed ? " left" : " " ,
224- /* renderBodyCell: ({ row, column, rowIndex }, h) => {
225- return ++rowIndex;
226- } */
226+ renderBodyCell: this .renderRowIndex
227227 });
228228
229229 columns = columns .concat ([
@@ -244,7 +244,7 @@ export default {
244244 title: " Sex" ,
245245 width: 50 ,
246246 align: " center" ,
247- // sortBy: "",
247+ sortBy: " " ,
248248 renderBodyCell : ({ row, column, rowIndex }, h ) => {
249249 const cellData = row[column .field ];
250250
@@ -282,7 +282,7 @@ export default {
282282 key: " e" ,
283283 title: " Proficiency" ,
284284 width: 150 ,
285- // sortBy: "",
285+ sortBy: " " ,
286286 renderBodyCell: (
287287 { row, column, rowIndex },
288288 h
@@ -336,8 +336,8 @@ export default {
336336 name: " Python" ,
337337 color: " #d8899c"
338338 },
339- { name: " java" , color: " #a88cd9" },
340- { name: " C++" , color: " #88d317" }
339+ { name: " java" , color: " #a88cd9" }
340+ /* { name: "C++", color: "#88d317" } */
341341 ];
342342
343343 const skills = LANGS .slice (0 , cellData);
@@ -376,7 +376,7 @@ export default {
376376 fixed: this .enableColumnFixed ? " right" : " " ,
377377 align: " left" ,
378378 // filter
379- /* filter: {
379+ filter: {
380380 filterList: [
381381 { value: 0 , label: " Working" , selected: false },
382382 { value: 1 , label: " Metting" , selected: false },
@@ -396,7 +396,7 @@ export default {
396396 }
397397 // max height
398398 // maxHeight: 120
399- }, */
399+ },
400400 renderBodyCell : ({ row, column, rowIndex }, h ) => {
401401 const cellData = row[column .field ];
402402
@@ -430,6 +430,21 @@ export default {
430430 }
431431 },
432432 methods: {
433+ // virtual scrolling
434+ scrolling ({
435+ scrollStartIndex,
436+ visibleStartIndex,
437+ visibleEndIndex,
438+ visibleAboveCount,
439+ visibleBelowCount
440+ }) {
441+ this .scrollStartIndex = scrollStartIndex;
442+ },
443+
444+ renderRowIndex ({ row, column, rowIndex }) {
445+ return < span> {rowIndex + this .scrollStartIndex + 1 }< / span> ;
446+ },
447+
433448 // search by name field
434449 searchByNameField (values ) {
435450 this .filterConditions = values;
@@ -517,7 +532,7 @@ export default {
517532 sex: Mock .Random .boolean () ? 1 : 2 ,
518533 profession: PROFESSIONS [Mock .Random .natural (0 , 5 )],
519534 proficiency: Mock .Random .natural (5 , 85 ),
520- skills: Mock .Random .natural (0 , 4 ),
535+ skills: Mock .Random .natural (0 , 3 ),
521536 address: Mock .Random .county (true ),
522537 status: Mock .Random .natural (0 , 2 )
523538 });
0 commit comments