等比列计算公式:百分比缩放const imgPect = (picture_width, picture_height, default_width, default_height) => {var widthRatio = default_width / picture_widthvar heightRatio = default_height / picture_heightvar ratio widthRatio < heightRatio ? ratio = widthRatio : ratio = heightRatiovar currentImg = { picture_width: parseInt(picture_width * ratio), picture_height: parseInt(picture_height * ratio)}return currentImg}
1200字范文,内容丰富有趣,写作的好帮手!