图片资源整合

方案1:(此情况适用于普通图片没有重名图片,不能为商家自己上传重复名称图片)

“image_src”: “https://api-hmugo-web.itheima.net/pyg/banner1.png

  • https://api-hmugo-web.itheima.net为域名
  • pyg代表这个模块的东西位置
  • banner1.png图片名称

方案2:(此情况适用于当商家自己传图片有重名,或者不同商家传了相同名称图片)

  • 后端安装muler npm install multer --save
    “image_src”: “https://api-hmugo-web.itheima.net/13478025-1.png
    13478025为时间戳,1.png为用户传的图片名称
    当用户传多张图片不会因为重名返回同样的图片,因为前面已经带了时间

猜你喜欢

转载自blog.csdn.net/qq_45432996/article/details/106401684