Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个显示图像画廊的角度应用程序。我想在用户单击“下一个”之前急切地在“下一个”画廊中加载图像(来自 URL),以便下一个画廊看起来会立即加载。
我可以想出一种方法来做到这一点,让隐藏的字段变得可见,但看起来并不特别优雅。有没有更好的办法?
拥有一组图像 url 并使用它们创建图像。
['image1.jpg', 'image2.jpg'].forEach(url => { (new Image()).src = url; });