我需要将一些jQuery代码转换为Angular 2,并且在弄清楚如何获取文档的高度时遇到了一些麻烦。
我使用的jQuery代码是
$(document).height();
我将如何在 Angular 2 中实现这一点?
谢谢
使用 document.height
在 angular 2 和控制台中都不起作用。
console.log(window.outerHeight);
console.log(window.innerHeight);
console.log(screen.height);
只使用document.height
而不使用 jQuery 怎么样?
文档高度
https://developer.mozilla.org/en-US/docs/Web/API/Document/height
这在普伦克尔工作
document.documentElement.clientHeight
普伦克示例