export default {
  methods: {
    deletePageLastItem(len = 1) {
      let page = this.currentPage || 1;
      if (this.$refs.table.data.length === len) {
        page = page > 1 ? page - 1 : 1;
      }
      this.handleCurrentChange && this.handleCurrentChange(page);
    },
    goback() {
      this.$router.go(-1);
    },
    getRouterPath(location) {
      const { href } = this.$router.resolve(location);
      return href;
    },
    indexMethod(index) {
      const currentPage = this.currentPage || 1;
      const size = this.pageSize || 10;
      return (currentPage - 1) * size + index + 1;
    },
  },
};
