首页 > 解决方案 > keep current page in vuetify when items change

问题描述

How to keep the current page in data tables in vuetify when the items is changed.

the current page is 2, add new item to items how to keep the current page 2

Codepen

标签: vue.jsvuejs2vuetify.js

解决方案


在向数据表添加条目之前,可以保存当前页码,添加条目成功后重新使用。

演示:https ://codepen.io/jacobgoh101/pen/odmEER?editors=0011

showFullMats (item) {
  // store current page number first
  this.prevPage = this.pagination.page;

  // codes for adding items...

  // reset to page number before adding item
  this.$nextTick().then(()=>{
    this.$set(this.pagination, 'page', this.prevPage);
  });
}

推荐阅读