<div>
<div>根据中间那个div高度设置此div高度</div>
<div ref="test">
<content v-for="item in items">
</content>
</div>
<div>根据中间那个div高度设置此div高度</div>
</div>
因为三个子div都是浮动的,父div没有设置浮动,不能设置height:100%。
浏览器里打印出来的this.refs.test.$el内的clientHeight显示是1400多,浏览器打印this.refs.test.$el.clientHeight却显示40,一头雾水。
在mounted取高度,不行的话,再加个this.$nextTick
1.可以用flex布局
2.数据是异步的话,watch监听、this.$nextTick里获取
ref获取实列,利用window.getComputedStyle(ref).height/width就能获取到实际大小带px单位