feat: 替换mockjs

This commit is contained in:
kailong321200875
2023-11-29 16:14:48 +08:00
parent b8f9a9940d
commit 7c76d945be
9 changed files with 249 additions and 207 deletions

View File

@@ -2,7 +2,7 @@
import { Waterfall } from '@/components/Waterfall'
import { ContentWrap } from '@/components/ContentWrap'
import { useI18n } from '@/hooks/web/useI18n'
import Mock from 'mockjs'
import { faker } from '@faker-js/faker'
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 = Mock.Random.integer(100, 500)
const width = Mock.Random.integer(100, 500)
list.push(
Mock.mock({
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({
width,
height,
id: toAnyString(),
// http更换为https
image_uri: Mock.Random.image(`${width}x${height}`).replace('http://', 'https://')
height
})
)
})
}
data.value = [...unref(data), ...list]
if (unref(data).length >= 60) {