Home > SYS_Window > getViewportSize
SYS_Window.getViewportSize() method
Get the current viewport size of the page
Signature
typescript
function getViewportSize(): { width: number; height: number };1
Returns
{ width: number; height: number }
Viewport width and height (in pixels)
Remarks
ADD since EDA v3.2.162
Example
javascript
// 1. 获取视口大小(同步方法,直接取值)
const size = eda.sys_Window.getViewportSize();
// 2. 展示宽高
console.log('视口宽:', size.width, 'px,视口高:', size.height, 'px');1
2
3
4
5
2
3
4
5