【发布时间】:2020-06-18 12:11:47
【问题描述】:
我正在尝试使用 computed 或 watch 来检测 body 的 scrollHeight 变化,但它不起作用。
这是我的代码:
computed: {
bodyScrollHeight() {
return document.body.scrollHeight;
}
},
watch:{
bodyScrollHeight: function(newValue) {
this.watchScrollHeight = newValue;
this.myFunction(newValue);
}
},
CodePen 链接:https://codepen.io/chhoher/pen/wvMoLOg
【问题讨论】:
-
那是滚动事件,但我想要的是检测scrollHeight值的变化。
-
请通过 jsfiddle 或 codepen 分享您的代码
标签: javascript vue.js vuejs2