您可以使用 layer.open 方法的 content 参数来指定要显示的图片地址,从而避免二次加载。以下是一个示例:

layer.open({
  type: 1,
  title: false,
  closeBtn: 1,
  area: 'auto',
  skin: 'layui-layer-nobg', // 无背景样式
  shadeClose: true,
  content: '<img src="http://example.com/image.jpg" />'
});

在上面的示例中,content 参数指定了要显示的图片的地址。您只需要将 http://example.com/image.jpg 替换为您要显示的图片的实际地址即可。

layeropen 如何调用网页上已显示的图片防止二次加载

原文地址: https://www.cveoy.top/t/topic/hRCf 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录