element分页

 这是element中的分页,具体的使用方法如下,亲测有效

   <div class="block">
          <el-pagination
            :current-page="currentPage"
            :page-sizes="[5, 10, 20, 40]"
            :page-size="pagesize"
            :total="tableData.length"
            layout="total, prev, pager, next"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            style="margin-top: 20px; text-align: right;"
          />
        </div>

 

data里面
 

 currentPage: 1,
 pagesize: 10,
 totalPages: 0,

methods:

  handleSizeChange: function (size) {
            this.pagesize = size;
          },
          handleCurrentChange: function (currentPage) {
            this.currentPage = currentPage;
          },

还有在table里面

    <el-table
          class="params-table"
          style="margin-top: 30px"
          :header-cell-style="{'background': '#109eae42', 'color': '#333'}"
          :data="tableData.slice((currentPage-1)*pagesize,currentPage*pagesize)">
          <el-table-column type="index"/>
          <!--员工编号-->
          <el-table-column
          prop="staffNumber"
          :label="$t('Workflow.Emplonumber')"
          align="center"/>
         <!--部门-->
          <el-table-column
           prop="work_flow_name"
          :label="$t('Workflow.department')"
          align="center"/>
        <!--角色-->
          <el-table-column
            prop="role"
            :label="$t('Workflow.role')"
            align="center"/>
          <!--零售额度-->
          <el-table-column
            prop="create_time"
            :label="$t('Workflow.Retail')"
            align="center"/>
          <!--工商额度-->
          <el-table-column
            prop="create_time"
            :label="$t('Workflow.Industria')"
            align="center"/>
          <!--更新时间-->
          <el-table-column
            prop="lastupdatedate"
            :label="$t('Workflow.UpdateT')"
            align="center"/>
          <!--配置时间-->
          <el-table-column
            prop="createdate"
            :label="$t('Workflow.Configuration')"
            align="center"/>
          <!--操作-->
          <el-table-column :label="$t('Workflow.operation')" width="200" align="center">
            <template slot-scope="scope">
              <el-button
                v-if="scope.row.status == 'COMPLETED'"
                size="mini"
                type="text"
                @click="view(scope.row)">
                {{$t("Workflow.view")}}
              </el-button>
              <el-button
                v-if="scope.row.status == 'ACTIVE'"
                size="mini"
                type="text"
                @click="resume(scope.row)">
                {{$t("Workflow.resume")}}
              </el-button>
              <el-button
                size="mini"
                type="text"
                @click="del(scope.row)">
                {{$t("common.delete")}}
              </el-button>
            </template>
          </el-table-column>
        </el-table>

不会的直接粘过去用就行

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Vue和Element UI是一对非常常用的组合,用于构建用户界面。在使用Element UI进行分页时,你可以使用Element UI的Pagination组件。 首先,确保你已经安装了Element UI。然后,在你的Vue组件中导入Pagination组件: ```javascript import { Pagination } from 'element-ui'; ``` 接下来,注册Pagination组件: ```javascript export default { components: { Pagination }, // ... } ``` 现在,你可以在模板中使用Pagination组件了。例如,在一个包含数据列表的页面中,你可以这样使用Pagination组件: ```html <template> <div> <!-- 数据列表 --> <ul> <li v-for="item in dataList" :key="item.id">{{ item.name }}</li> </ul> <!-- 分页 --> <el-pagination @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="totalItems" ></el-pagination> </div> </template> ``` 在上述示例中,我们使用了el-pagination标签来创建分页组件。其中,current-page属性绑定到了currentPage变量,用于指定当前页码。page-sizes属性是一个数组,用于指定每页显示的条目数选项。pageSize属性用于指定当前页显示的条目数。layout属性用于自定义分页组件的布局。 在处理分页事件时,我们可以使用@current-change监听器来捕获页码变化事件: ```javascript methods: { handleCurrentChange(page) { // 更新当前页码 this.currentPage = page; // 根据新的页码获取数据 this.getData(); }, getData() { // 根据当前页码和每页显示的条目数获取数据 // 更新数据列表 } } ``` 以上就是使用Vue和Element UI进行分页的基本步骤。你可以根据自己的需求进行进一步的定制和样式调整。希望对你有所帮助!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值