Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

317
Views
Mostrar el número de registros para mostrar (paginación) en Vue

Tengo una tabla con paginación en mi proyecto Vue. Tengo esos campos:

  • El campo tableItemsPerPage contiene el número de elementos que se mostrarán por página (10, 25, 50, 100).
  • El campo tableCrrentPage contiene el número de página actual.
  • Los items de campo contienen los elementos (matriz).

Quiero mostrar el siguiente mensaje:

 Showing 1 to 10 out of 1500 records. Showing 11 to 20 out of 1500 records. ...

El código:

 getRecordsText: function() { var records_amount = this.items.length; var start = this.tableCrrentPage; var end = this.tableCrrentPage; return start + " to " + end + " out of " + records_amount + " records"; }

No estoy seguro de cómo calcular el start y el end en función de esos campos. ¿Hay alguna fórmula que pueda construir que pueda mostrar los mensajes?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Vea la tabla de abajo

 1 2 3 4 5 6 7 8 9 abc

aquí tableItemsPerPage = 4

suponiendo que tableCrrentPage es inicialmente 0

usted obtiene

{ start, end } = { start: (tableCrrentPage * 4 ) + 1, end: (tableCrrentPage * 4 ) + 4 }

 x= (p, n) => ({ start: (p * n) + 1, end: (p * n) + n }) console.log('10 items per page') console.log(x(0, 10)) console.log(x(1, 10)) console.log(x(2, 10)) console.log('20 items per page') console.log(x(0, 20)) console.log(x(1, 20)) console.log(x(2, 20))

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!