diff --git a/package.json b/package.json index c3c8fc6..7644c21 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@lhlyu/vue-virtual-waterfall", "description": "vue3 virtual waterfall component", - "version": "1.0.6-beta.1", + "version": "1.0.6-beta.2", "author": "lhlyu", "repository": { "type": "git", diff --git a/src/example/Card.vue b/src/example/Card.vue index c29c99a..2ff3936 100644 --- a/src/example/Card.vue +++ b/src/example/Card.vue @@ -3,7 +3,6 @@ class="card" :data-id="item.id" > -
{ - url = url.replace('_p0.', '_p0_master1200.') - url = url.replace('.png', '.jpg') - return proxy_base_url + 'c/540x540_70/img-master/' + url -} - -const handlerAvatar = (url: string): string => { - url = url.replace('.', '_50.') - return proxy_base_url + url -} - // 计算真实高度,这里只计算除了图片的高度 function getRealHeight(item: ItemOption, realWidth: number) { const dom = document.createElement('div') @@ -94,7 +76,7 @@ const useWaterfall = () => { return } data.page += 1 - const response = await fetch(`https://mock.tatakai.top/images/${data.page}/${data.size}`) + const response = await fetch(`https://mock.tatakai.top/images?page=${data.page}&size=${data.size}&mode=simple`) const result = await response.json() if (!result.list.length) { data.end = true @@ -102,23 +84,7 @@ const useWaterfall = () => { } data.total = result.total data.max = result.max - - const list: ItemOption[] = [] - - for (let i = 0; i < result.list.length; i++) { - list.push({ - id: result.list[i].id, - title: result.list[i].title, - url: handlerUrl(result.list[i].url), - width: result.list[i].width, - height: result.list[i].height, - avatar: handlerAvatar(result.list[i].author.avatar), - user: result.list[i].author.name, - views: result.list[i].statistic.views - }) - } - - data.list = [...data.list, ...list] + data.list = [...data.list, ...result.list] } // 检查是否加载更多