From aee613034fa13c986018ae11d23dcacc679a088f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=A0=E6=9C=A8?= Date: Mon, 7 Jun 2021 01:14:07 +0800 Subject: [PATCH] refactor(mock): remove third-party images --- mock/demo/table-demo.ts | 12 +++++++++++ src/views/demo/table/CustomerCell.vue | 31 ++++++--------------------- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/mock/demo/table-demo.ts b/mock/demo/table-demo.ts index a455e2dc..2fae797f 100644 --- a/mock/demo/table-demo.ts +++ b/mock/demo/table-demo.ts @@ -1,6 +1,15 @@ import { MockMethod } from 'vite-plugin-mock'; +import { Random } from 'mockjs'; import { resultPageSuccess } from '../_util'; +function getRandomPics(count = 10): string[] { + const arr: string[] = []; + for (let i = 0; i < count; i++) { + arr.push(Random.image('800x600', Random.color(), Random.color(), Random.title())); + } + return arr; +} + const demoList = (() => { const result: any[] = []; for (let index = 0; index < 60; index++) { @@ -18,6 +27,9 @@ const demoList = (() => { name6: '@cname()', name7: '@cname()', name8: '@cname()', + avatar: Random.image('400x400', Random.color(), Random.color(), Random.first()), + imgArr: getRandomPics(Math.ceil(Math.random() * 3) + 1), + imgs: getRandomPics(Math.ceil(Math.random() * 3) + 1), date: `@date('yyyy-MM-dd')`, time: `@time('HH:mm')`, 'no|100000-10000000': 100000, diff --git a/src/views/demo/table/CustomerCell.vue b/src/views/demo/table/CustomerCell.vue index 869ab255..1f74d07a 100644 --- a/src/views/demo/table/CustomerCell.vue +++ b/src/views/demo/table/CustomerCell.vue @@ -8,32 +8,12 @@ - -