当前位置:网站首页>js 判断链接图片是否存在
js 判断链接图片是否存在
2022-07-22 05:51:00 【油墨香^_^】
checkImgExists(imgUrl) {
return new Promise(function (resolve, reject) {
const ImgObj = new Image();
ImgObj.src = imgUrl;
ImgObj.onload = (res) => {
resolve(res);
};
ImgObj.onerror = (err) => {
reject(err);
};
});
}
checkImgExists(url)
.then(() => {
this.imgUrl = url;
})
.catch(() => {
this.imgUrl = null;
});
边栏推荐
- 服务器buffer/cache 的产生原因和释放buffer/cache
- numpy.ascontiguousarray
- numpy.random.seed()
- Atomicinteger class is used in multithreading to ensure thread safety
- UE4 level blueprint realizes door opening and closing
- 16_ Response status code
- Codeforce d2. RGB substring (hard version) sliding window
- 工作流引擎在vivo营销自动化中的应用实践 | 引擎篇03
- Digital path and practical thinking
- Cross domain problem (CORS) detailed description and solution
猜你喜欢
1143. Longest common subsequence
DOF depth of field Foundation
Angr principle and Practice (I) -- principle
Crack PLSQL by deleting the registry
电子信息工程专业毕设题目选题推荐
UE4 create a project
vim入门
一文带你了解redux的工作流程——action/reducer/store
Web 应用程序渗透测试的四个主要步骤
Hande apaas low code platform Feida 2.3.0 release was officially released!
随机推荐
服务器网络性能调优案例
MySQL中的日志“binlog”的三种格式这么好玩
GMT 0009-2012 data format go language operation
Upgrade MySQL 5.6 to 8.0 on Windows
Polygon chain matic concept and underlying mechanism
UE4 combines the objects made by the brush into a whole
论文阅读【6】Autoaugment: Learning augmentation strategies from data
Spark高级特性,220720,
FPGA - memory resources of internal structure of 7 Series FPGA -02- FIFO resources
Lepton 无损压缩原理及性能分析
Use OpenCV to achieve the halo effect
【机器学习】pytorch如何加载自定义数据集并进行数据集划分
修复版动态视频壁纸微信小程序源码下载,支持多种类型流量主收益
In the arm64 environment, the third-party library hajimehoshi/oto of golang relies on the solution of alsa lib and CGO
Detailed explanation of wechat payment project practice, order creation to payment refund code
UE4 enters the designated area to realize the trigger acceleration function
14-多线程1
16_ Response status code
Ora-16525 DG broker not available
UE4 build terrain with grayscale map