我有一个很长的base64类型字符串,我想设置为src图像的
$('#img').attr('src',base64data)
console.log('height - ' $('#img').height());
console.log('width - ' $('#img').height());
看起来我回来0了。当然,如果我等一会儿,我会得到合适的高度。heightwidth
问题是.attr()没有回调,我将如何在src设置属性后获取高度和宽度而不0返回。(我想我得到 0 因为 Jquery 的变化是异步发生的,但我不能太确定)