1. Dynamic binding styles in HTML:
<div :style="styleChange"></div>
Copy the code
2. Definition in data:
data(){
return{
styleChange: {
height: "",
width:''
},}
}
Copy the code
3. Methods:
mounted() { const that = this; that.styleChange.height = window.innerHeight + "px"; Width = window.innerWidth+'px'; // Screen height that.stylechange. width = window.innerWidth+'px'; // Screen width console.log(" height ", thate.stylechange.height); Console. log(" width ", thate.stylechange.width); }Copy the code
-
Page visible region wide: document. Body. ClientWidth
-
High page visible area: the document. The body. ClientHeight
-
Page visible region wide: document. Body. OffsetWidth (including line width)
-
High page visible area: the document. The body. OffsetHeight (including line width)
-
Page of text in full width: document. Body. ScrollWidth
-
High page of text in full: document. Body. ScrollHeight
-
The page is rolled high: document.body.scrolltop
-
Page is rolled to the left: document.body.scrollLeft
-
Window. ScreenTop in the body of the page
-
Left of the page body: window.screenleft
-
High screen resolution: window.screen.height
-
Width of screen resolution: window.screen.width
-
Screen available workspace height: window. Screen. AvailHeight
-
Screen available workspace width: window.screen.availWidth
-
Get the window width: window.innerWidth
-
Get the window height: window.innerheight