Vue3는 인터페이스에서 반환된 그림의 너비와 높이를 가져옵니다.

 let img = new Image();
    img.src = '图片的链接';
    img.onload = async () => {
           console.log(img.width)
           console.log(img.height)
    };`

참고: 비동기가 아닌 경우 온로드해야 값을 얻을 수 있습니다.

패키지:

async function getVideo(fileUrl: any) {
    
    
  return new Promise((resolve) => {
    
    
    let img = new Image();
    img.src = fileUrl;
    img.onload = async () => {
    
    
      let type = img.width / img.height > 1 ? "video-w" : "video-h";
      resolve(type);
    };
  });
}

옮기다:

    getVideo(url).then((res) => {
    
    
        console.log(res);
        
      });

추천

출처blog.csdn.net/qq_41697998/article/details/128317495