data.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import { shallowRef } from 'vue'
  2. let ID = 1
  3. function _random(max: number) {
  4. return Math.round(Math.random() * 1000) % max
  5. }
  6. export function buildData(count = 1000) {
  7. const adjectives = [
  8. 'pretty',
  9. 'large',
  10. 'big',
  11. 'small',
  12. 'tall',
  13. 'short',
  14. 'long',
  15. 'handsome',
  16. 'plain',
  17. 'quaint',
  18. 'clean',
  19. 'elegant',
  20. 'easy',
  21. 'angry',
  22. 'crazy',
  23. 'helpful',
  24. 'mushy',
  25. 'odd',
  26. 'unsightly',
  27. 'adorable',
  28. 'important',
  29. 'inexpensive',
  30. 'cheap',
  31. 'expensive',
  32. 'fancy',
  33. ]
  34. const colours = [
  35. 'red',
  36. 'yellow',
  37. 'blue',
  38. 'green',
  39. 'pink',
  40. 'brown',
  41. 'purple',
  42. 'brown',
  43. 'white',
  44. 'black',
  45. 'orange',
  46. ]
  47. const nouns = [
  48. 'table',
  49. 'chair',
  50. 'house',
  51. 'bbq',
  52. 'desk',
  53. 'car',
  54. 'pony',
  55. 'cookie',
  56. 'sandwich',
  57. 'burger',
  58. 'pizza',
  59. 'mouse',
  60. 'keyboard',
  61. ]
  62. const data = []
  63. for (let i = 0; i < count; i++)
  64. data.push({
  65. id: ID++,
  66. label: shallowRef(
  67. adjectives[_random(adjectives.length)] +
  68. ' ' +
  69. colours[_random(colours.length)] +
  70. ' ' +
  71. nouns[_random(nouns.length)],
  72. ),
  73. })
  74. return data
  75. }