common.js 573 B

1234567891011121314151617181920212223
  1. export default {
  2. methods: {
  3. deletePageLastItem(len = 1) {
  4. let page = this.current || 1;
  5. if (this.$refs.TableList.data.length === len) {
  6. page = page > 1 ? page - 1 : 1;
  7. }
  8. this.toPage && this.toPage(page);
  9. },
  10. goback() {
  11. this.$router.go(-1);
  12. },
  13. getRouterPath(location) {
  14. const { href } = this.$router.resolve(location);
  15. return href;
  16. },
  17. indexMethod(index) {
  18. const current = this.current || 1;
  19. const size = this.size || 10;
  20. return (current - 1) * size + index + 1;
  21. },
  22. },
  23. };