When using document to get the dom node in vue to change the node style, the error 'style' is not definde may occur. At this time, you can use $refs in mounted to get the style and make changes:
<template> <div style="display: block;" ref="abc"> <!-- ... --> </div> </template> <script> export default { mounted () { (this.$) } } </script>
The result is display: block;
If we set a full-screen background image for a div, we need to obtain the screen height and assign it:
<template> <div ref="nana"> <!-- ... --> </div> </template> <script> export default { mounted () { let w = || || ; let h = || || ; this.$ = h +'px'; } } </script>
The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.