2.若只指定一个,则宽高相,300*300
<img src="https://picsum.photos/300" alt="">
3.指定图库指定id,id:125/200*300
<img src="https://picsum.photos/id/125/200/300" alt="">
4.根据传入固定seed值获得相同的随机图像,方法是在URL开头添加/seed/{seed}
seed:sdf/(200*300){将传入的seed值转成唯一的哈希码,并用该哈希码生成图片,因此相同的seed值返回同一张图片}
<img src="https://picsum.photos/seed/sdf/200" alt="">
5.在链接末尾添加?grayscale,生成灰度图片,灰度图片/200*300
<img src="https://picsum.photos/200/300?grayscale" alt="">
6.在链接末尾添加?blue,生成模糊图片,模糊图片blur值1-10可选,来调整模糊量/200*300
<img src="https://picsum.photos/200/200/?blur=5" alt="">
7.请求多张相同大小的图像,请添加random查询参数以防止图像被缓存,random参数/200*300
<img src="https://picsum.photos/200/300?random=1"> <img src="https://picsum.photos/200/300?random=2">
8.指定图片格式,在结尾加上相应的后缀支持jpg,webp(png搜索说支持,实测不行)
<img src="https://picsum.photos/200/300.jpg"> <img src="https://picsum.photos/200/300.webp">
9.图片列表:https://picsum.photos/v2/list,默认每页30条,https://picsum.photos/v2/list?page=2&limit=10,通过page参数请求设置页码,通过limit设置每页请求个数
数据格式:
[ { "id": "0", "author": "Alejandro Escamilla", "width": 5616, "height": 3744, "url": "https://unsplash.com/...", "download_url": "https://picsum.photos/..." } ]
代码地址:https://gitee.com/yuexiayunsheng/vue3learn/blob/master/src/views/LoremPicsum.vue