收藏
回答

给图片设置了动态内联高度,但是获取父层view高度却是图片的默认高度240px

框架类型 问题类型 操作系统 工具版本
小程序 Bug Windows v1.02.2004020

代码片段:https://developers.weixin.qq.com/s/kkM6Htm37Phm

//获取父层高度
   var query = wx.createSelectorQuery();
    query.select('.details_content').boundingClientRect()
    query.exec(function (res{
    var detailH=res[0].height;     
    that.setData({
      detailHeight: detailH+'px', 
    }) 
    //console.log(res);   
    }) 
//获取图片高度
imgH:function(e){
    var winWid = wx.getSystemInfoSync().windowWidth;    
    var imgh = e.detail.height;
    var imgw = e.detail.width;
    var imgH = winWid * imgh / imgw + 'px';
    this.setData({
      imgHeight:imgH
    })
  },
最后一次编辑于  2020-05-20
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签