mirror of https://github.com/vuejs/core.git
79 lines
1.2 KiB
TypeScript
79 lines
1.2 KiB
TypeScript
import { shallowRef } from '@vue/vapor'
|
|
|
|
let ID = 1
|
|
|
|
function _random(max: number) {
|
|
return Math.round(Math.random() * 1000) % max
|
|
}
|
|
|
|
export function buildData(count = 1000) {
|
|
const adjectives = [
|
|
'pretty',
|
|
'large',
|
|
'big',
|
|
'small',
|
|
'tall',
|
|
'short',
|
|
'long',
|
|
'handsome',
|
|
'plain',
|
|
'quaint',
|
|
'clean',
|
|
'elegant',
|
|
'easy',
|
|
'angry',
|
|
'crazy',
|
|
'helpful',
|
|
'mushy',
|
|
'odd',
|
|
'unsightly',
|
|
'adorable',
|
|
'important',
|
|
'inexpensive',
|
|
'cheap',
|
|
'expensive',
|
|
'fancy',
|
|
]
|
|
const colours = [
|
|
'red',
|
|
'yellow',
|
|
'blue',
|
|
'green',
|
|
'pink',
|
|
'brown',
|
|
'purple',
|
|
'brown',
|
|
'white',
|
|
'black',
|
|
'orange',
|
|
]
|
|
const nouns = [
|
|
'table',
|
|
'chair',
|
|
'house',
|
|
'bbq',
|
|
'desk',
|
|
'car',
|
|
'pony',
|
|
'cookie',
|
|
'sandwich',
|
|
'burger',
|
|
'pizza',
|
|
'mouse',
|
|
'keyboard',
|
|
]
|
|
const data = []
|
|
for (let i = 0; i < count; i++)
|
|
data.push({
|
|
id: ID++,
|
|
label: shallowRef(
|
|
adjectives[_random(adjectives.length)] +
|
|
' ' +
|
|
colours[_random(colours.length)] +
|
|
' ' +
|
|
nouns[_random(nouns.length)],
|
|
),
|
|
})
|
|
return data
|
|
}
|