perf: 还原mock.js

This commit is contained in:
kailong321200875
2023-12-25 17:25:33 +08:00
parent a18bc641e8
commit 83de387e2a
8 changed files with 217 additions and 246 deletions

View File

@@ -2,7 +2,7 @@
import { Waterfall } from '@/components/Waterfall'
import { ContentWrap } from '@/components/ContentWrap'
import { useI18n } from '@/hooks/web/useI18n'
import { faker } from '@faker-js/faker'
import Mock from 'mockjs'
import { ref, unref } from 'vue'
import { toAnyString } from '@/utils'
@@ -12,17 +12,17 @@ const getList = () => {
const list: any = []
for (let i = 0; i < 20; i++) {
// 随机 100, 500 之间的整数
const height = faker.number.int({ min: 100, max: 500 })
const width = faker.number.int({ min: 100, max: 500 })
list.push({
width,
height,
id: toAnyString(),
image_uri: faker.image.url({
const height = Mock.Random.integer(100, 500)
const width = Mock.Random.integer(100, 500)
list.push(
Mock.mock({
width,
height
height,
id: toAnyString(),
// http更换为https
image_uri: Mock.Random.image(`${width}x${height}`).replace('http://', 'https://')
})
})
)
}
data.value = [...unref(data), ...list]
if (unref(data).length >= 60) {