vue获取某个标签的高度,渲染后的高度

需求: 想三边高度一致, 主要看截图 

代码

html:使用 this.$refs.inforTitleR.clientHeight 获取该元素的高度

js部分

// 先data里定义
comHeight: "126px",
// 数据赋值函数里   判断高度 让高度都==右侧的高度 注意减去增加的padding20
   this.$nextTick(function() {
      this.comHeight = this.$refs.inforTitleR.clientHeight - 20 + "px";
   });
  watch: {
    comHeight: {
      handler(newVal, oldVal) {
        if (newVal) {
          this.comHeight = newVal;
        }
      }
    }
  },

 css随便都可以,根据UI图等

原文地址:https://www.cnblogs.com/wangduojing/p/14785130.html