怎么点击获取图片宽高?

小程序 文章 2020-07-31 17:21 547 0 全屏看文

AI助手支持GPT4.0

怎么点击获取图片宽高?
 <image bindload="imgload" class="allimg" mode="widthFix" data-id="{{index}}" src='{{item[0]}}' bindtap="bindChooseType"></image>我怎么才能在点击bindChooseType的时候 获取当前点击的这张图片的宽高呢

< imag ﹤ e ﹤ bindload = "imgload" class = "allimg" mode = "widthfix" data id = {{index}} "SRC = '{{item [0]}}' bindtap =" bindchoosetype "> < / Image > How can I get the width and height of the image I click on when I click bindchoosetype

回答:

杭州弧途科技有限公司:

getImageInfo

微喵网络:

bindload的时候就能获取到图片的宽高,存下来,点击的时候直接读取

จุ๊บ:

点击的时候,把图片路径传过去,调用 wx.getImageInfo 就行了

雷火🔥:这个可以有,onload也不错

-EOF-

AI助手支持GPT4.0