Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. My text document Date: 20-06-2019 Created by: OJN
  2.  
  3. Content Nice Document Very!
  4.  
  5. Content Indeed!
  6.  
  7. Even more!
  8.  
  9. {
  10. "1":[
  11. {
  12. "row":"My text document"
  13. },
  14. {
  15. "row":"Content"
  16. },
  17. {
  18. "row":"Content"
  19. }
  20. ],
  21. "2":[
  22. {
  23. "row":"Date: 20-06-2019"
  24. },
  25. {
  26. "row":"Nice Document"
  27. },
  28. {
  29. "row": "Indeed!"
  30. },
  31. {
  32. "row": "Even more!"
  33. }
  34. ],
  35. "3":[
  36. {
  37. "row":"Created by: OJN"
  38. },
  39. {
  40. "row":"Very!"
  41. }
  42. ]
  43. }
  44.  
  45. 0: Array(3)
  46. 1: Array(4)
  47. 2: Array(2)
  48.  
  49. <table border="1">
  50. <tbody>
  51. <tr v-for="(row, index) in dataTable" :key="index">
  52. <td v-for="(cell, index) in row" :key="index">
  53. <span v-if="cell">{{cell["row"]}}</span>
  54. </td>
  55. </tr>
  56. </tbody>
  57. </table>
  58.  
  59. // Transform object in array of its values
  60. let data = Object.values(content);
  61. let colsLength = data.map(r => r.length);
  62. let maxNumCols = Math.max.apply(Math, colsLength);
  63. let recordArraySchema = Array.apply(null, Array(maxNumCols)).map((r, i) => i);
  64.  
  65. this.dataTable = recordArraySchema.map((col, i) => data.map(row => row[i]));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement