Hi FE !
Ai
git
前端面试题
前端小tip
  • vite
  • webpack
npm
  • vue2
  • vue3
react
GitHub
Ai
git
前端面试题
前端小tip
  • vite
  • webpack
npm
  • vue2
  • vue3
react
GitHub
  • 分页

分页

      <el-pagination
        background
        layout="prev, pager, next"
        @current-change="changePage"
        :current-page.sync="currentPage"
        :page-size="pageSize"
        :total="total"
        v-if="total != 0"
        >
    </el-pagination>

    data() {
        return {
              total: 10, //总页数
              currentPage: 1, //当前页
              pageSize: 20,
        }
    }

    methods:{
        //选择页数
        changePage(str) {
              console.log("选择的页数", str);
              this.currentPage = str;
              this.getData();
        },
        getData() {
          let obj = {
            exchange_name: this.exchange_name,
            page: this.currentPage,
            pageSize: this.pageSize,
          };
      fetchCodeList(obj)
        .then((res) => {
          console.log("兑换码管理列表", res);
          this.tableData = res.data.data;

                this.total = res.data.totalCount;
 
        })
        .catch((err) => {
          console.log(err);
        });
    },
    }

Edit this page
最近更新: 2025/12/2 01:46
Contributors: qdleader
qdleader
本站总访问量 129823次 | 本站访客数 12人