在methods中当我点击按钮(details) 是可以出来元素高度的,
但在height方法中 在mounted后调用却报错请问是为什么?我尝试着用mounted后的其他钩子但错误仍在。
加个this.$nextTick
我看 detalis 可以打印 。height 里 你先 获取 dom看看能不能获取到 。
这样写试试
let he=document.getElementById("contentHeight");
if(he){
consoel.log(he.height)
}