父元素使用min-height,子元素设置height:100%不会继承父元素的高度
解决方法
可以使用js获取父元素,强制给子元素添加高度:
vue:
this.$nextTick(() => { this.$refs.line.style.height =this.$refs.wrapper.getBoundingClientRect().height + "px"; });
min-height 对子元素的影响
最新推荐文章于 2023-06-26 15:41:10 发布
父元素使用min-height,子元素设置height:100%不会继承父元素的高度
解决方法
可以使用js获取父元素,强制给子元素添加高度:
vue:
this.$nextTick(() => { this.$refs.line.style.height =this.$refs.wrapper.getBoundingClientRect().height + "px"; });