// 提前下载资源
fetch("/path/to/animation.gif")
.then(response => response.blob())
.then(blob => {
// Store blob for later use.
this.cachedAnimationBlob = blob
})
// 生成内存地址使用
this.uniqueAnimationSrc = window.URL.createObjectURL(this.cachedAnimationBlob)
优势: 当需要更新图片特别是gif需要重头播放时,区别于时间戳方式能节省资源,fetch默认有缓存从缓存读取