🐛(component): 修复layer title闪烁抖动问题,待商榷

This commit is contained in:
0o张不歪o0
2022-06-26 01:07:05 +08:00
parent 7d8798be8e
commit 33ad94f2b7
3 changed files with 12 additions and 20 deletions

View File

@@ -238,27 +238,9 @@ export function getDrawerAnimationClass(offset: any, isClose: boolean = false) {
return isClose ? `${prefix}-${suffix}-close` : `${prefix}-${suffix}`;
}
//图片预加载
export function loadImage(url: string, callback: Function, error: any) {
let img = new Image();
img.src = url;
if (img.complete) {
return callback(img);
}
img.onload = function () {
img.onload = null;
callback(img);
};
img.onerror = function (e) {
img.onerror = null;
error(e);
};
}
export async function calculatePhotosArea(url: string, options: object) {
let img = new Image();
img.src = url;
return new Promise((resolve, reject) => {
if (img.complete) {
resolve(area(img));