The serial number of the list page of vue2-element,vue3-element-plus

Foreword:

Here, the list of Ele.me frameworks used in vue2 and vue3, the function that the serial number increases with the page

view2:

page=current page, pageSize=how many items are displayed on one page

type="index" :index="indexMethod"

//  序号翻页连续排序
  indexMethod(index) {
    return (this.page-1)*this.pageSize+index+1;
  },

vue3:

page=current page, pageSize=how many items are displayed on one page

page:

<el-table-column
        type="index"
        :index="indexMethod"
        label="序号"
        align="center">
      </el-table-column>

js:

setup () {

    //翻页分页递增
      const indexMethod = (index) => {
        return (state.searchForm.page-1) * state.searchForm.pageSize + index + 1;
      }
    return {
        indexMethod,
    }
}

Guess you like

Origin blog.csdn.net/qq_41619796/article/details/122847516