【在线OJ】vue分页+SpringBoot分页模板代码

news/2024/7/5 7:58:13

一、Vue

<template>
  <div>
    <el-table
        :data="user"
        style="width: 120%">
      <el-table-column
          label="id"
          width="180">
        <template slot-scope="scope">
          <i class="el-icon-time"></i>
          <span style="margin-left: 10px">{{ scope.row.id }}</span>
        </template>
      </el-table-column>
      <el-table-column
          label="昵称"
          width="180">
        <template slot-scope="scope">
          <el-popover trigger="hover" placement="top">
            <p>描述: {{ scope.row.description }}</p>
            <p>rate: {{ scope.row.rating }}</p>
            <div slot="reference" class="name-wrapper">
              <el-tag size="medium">{{ scope.row.nickname }}</el-tag>
            </div>
          </el-popover>
        </template>
      </el-table-column>
      <el-table-column
          label="账户"
          width="180">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.account }}</span>
        </template>
      </el-table-column>
      <el-table-column
          label="邮箱"
          width="180">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.email }}</span>
        </template>
      </el-table-column>
      <el-table-column
          label="创建时间"
          width="180">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.createTime }}</span>
        </template>
      </el-table-column>
      <el-table-column
          label="IP"
          width="180">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.ip }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
              size="mini"
              @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
          <el-button
              size="mini"
              type="danger"
              @click="handleDelete(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
        :total="total"
        :page-size="pageSize"
        :current-page="currentPage"
        layout="prev, pager, sizes, next, ->, total"
        @current-change="currentChange"
        @size-change="sizeChange">
    </el-pagination>
  </div>
</template>

<script>
export default {
  data() {
    return {
      user: [
        {id: 1, nickname: '1886',description: '这个人很懒', ip: '127.0.0.1', account: '1881', rating: 98,email: '218933@qq.com', createTime: "2023-10-10 12:20:01"},
        {id: 2, nickname: '18186',description: '这个人很懒', ip: '127.0.0.1', account: '1881', rating: 98,email: '218933@qq.com', createTime: "2023-10-10 12:20:01"},
        {id: 3, nickname: '18816', description: '这个人很懒',ip: '127.0.0.1', account: '1881', rating: 98,email: '218933@qq.com', createTime: "2023-10-10 12:20:01"},
        {id: 4, nickname: '18826',description: '这个人很懒', ip: '127.0.0.1', account: '1881', rating: 98,email: '218933@qq.com', createTime: "2023-10-10 12:20:01"},
        {id: 5, nickname: '18386', description: '这个人很懒',ip: '127.0.0.1', account: '1881', rating: 98,email: '218933@qq.com', createTime: "2023-10-10 12:20:01"},

      ],
      // 当前页码
      currentPage: 1,
      // 一页数据
      pageSize: 10,
      // 数据总数
      total: 100
    }
  },

  mounted() {
    this.getData() // 页码加载获取数据
  },

  methods: {
    getData() {
      alert("发起http请求获取数据")
    },
    handleEdit(index, row) {
      this.$message.warning(index + ":edit:" + row)
      console.log(index, row);
    },
    handleDelete(index, row) {
      this.$message.warning(index + ":delete:" + row)
      console.log(index, row);
    },
     //页面改变 发起请求获取分页数据
    currentChange: function (page) {
      this.currentPage = page;
      this.$message({
        message: '查询页:' + page,
        type: 'success'
      });
     this.getData()

    },
    // 页面展示数据条数改变 发起请求获取数据
    sizeChange: function (size) {
      this.pageSize = size;
      this.$message({
        message: '查询条数:' + this.pageSize,
        type: 'success'
      });
      this.getData()
    },
  },
  components: {

  }
}
</script>

二、SpringBoot

        PageHelper.startPage(queryVo.getPage(), queryVo.getSize());
        PageInfo<ProblemsDTO> problemsDTOPageInfo = new PageInfo<>(res);
        problemsDTOPageInfo.setTotal(res.size());
        return problemsDTOPageInfo;


http://lihuaxi.xjx100.cn/news/2215820.html

相关文章

C# String

String字符串字面量字符串连接字符串是不可变的字符串比较字符串方法字符串插值字符串和字符数组字符串格式化空字符串和 null字符串的安全性正则表达式 注意String.Format基本语法参数 基本使用使用索引指定对齐和宽度使用格式字符串组合使用 总结 C# String 在C#中&#xff0…

Elasticsearch 8.1官网文档梳理 - 十一、Ingest pipelines(管道)

Ingest pipelines 管道&#xff08;Ingest pipelines&#xff09;可让让数据在写入前进行常见的转换。例如可以利用管道删除文档&#xff08;doc&#xff09;的字段、或从文本中提取数据、丰富文档&#xff08;doc&#xff09;的字段等其他操作。 管道&#xff08;Ingest pip…

牛客小白月赛96 D 最小连通代价

题目在这里 题意: 加边是所有点连通&#xff0c;没有重边和自环,问最小代价 加边规则&#xff1a;两点权值奇偶性相同代价为a,否则为b − 100 ≤ a , b ≤ 100 -100\leq a,b \leq100 −100≤a,b≤100 分析&#xff1a; 这题就是一个分类讨论,先读进来统计奇数点和偶数点 记 …

Temu跨境电商按关键字搜索Temu商品API的应用及接口请求示例

Temu跨境电商按关键字搜索Temu商品API的应用场景 Temu跨境电商平台按关键字搜索Temu商品API的主要应用场景包括但不限于以下几个方面&#xff1a; 用户搜索商品&#xff1a;当用户在Temu平台上输入关键字搜索商品时&#xff0c;API会根据输入的关键字返回与之相关的商品列表&a…

Spring框架的原理及应用详解(五)

本系列文章简介&#xff1a; 在当今的软件开发世界中&#xff0c;随着应用复杂性的不断增加和技术的快速发展&#xff0c;传统的编程方式已经难以满足快速迭代、高可扩展性和易于维护的需求。为此&#xff0c;开发者们一直在寻求更加高效、灵活且易于管理的开发框架&#xff0c…

【杂记-浅谈以太网IP数据帧】

一、以太网数据帧 以太网数据帧是网络通信的基础单元&#xff0c;遵循IEEE 802.3标准&#xff0c;用于在以太网中传输数据。一个典型的以太网数据帧包括前导码、帧开始符、目的MAC地址、源MAC地址、类型或长度字段、数据载荷和帧校验序列。其中&#xff0c;类型字段指明了上层…

Scala网络编程:代理设置与Curl库应用实例

在网络编程的世界里&#xff0c;Scala以其强大的并发模型和函数式编程特性&#xff0c;成为了开发者的得力助手。然而&#xff0c;网络请求往往需要通过代理服务器进行&#xff0c;以满足企业安全策略或访问控制的需求。本文将深入探讨如何在Scala中使用Curl库进行网络编程&…

SpringBoot如何自定义启动Banner 以及自定义启动项目控制台输出信息 类似于若依启动大佛 制作教程

前言 Spring Boot 项目启动时会在控制台打印出一个 banner&#xff0c;下面演示如何定制这个 banner。 若依也会有相应的启动动画 _ooOoo_o8888888o88" . "88(| -_- |)O\ /O____/---\____. \\| |// ./ \\||| : |||// \/ _||||| -:- |||||- \| | \\…