vue表格index序号随着分页的增加而增加

模版:
<el-table-column type="index" label="序号" width="60" :index="tableIndex" />

 

vue3中的js写法:
const state = reactive ({
  page:{
     currentPage:1,
     pageSize:30,
     total:0
  },
});

const tableIndex = (index) => {
   return (state.page.currentPage-1) * state.page.pageSize + index + 1;
 };

return {
   ...toRefs(state),
   tableIndex,

};

 

 
posted @ 2022-04-14 11:32  民工黑猫  阅读(595)  评论(0编辑  收藏  举报