Vue cannot be called to the height of the element through refs in mounted

< H2 > Vue in mounted , refs cannot call to height of element < / H2 >
the requirement takes the height of the element after the page is loaded, and then assigns it to another element
after calculation.

clipboard.png
you can see that the top is fxied , so it causes the lower text (the size of the top is uncertain and cannot be set directly through css ), so you need to load the page and get it and assign a value to the div below

.
        mounted() {
            setTimeout(() => {
                const heightA = window.getComputedStyle(this.$refs.header).height;
                console.log("heightA ==> "+heightA);
            }, 1000);
        }

output 50px

the last one can be obtained, but it is not satisfied to get the height immediately after the page is loaded
Aug.05,2021

mounted just because the vue rendering has been completed does not mean that the styles in it have also been rendered.
when you are reading height, the page has not been rendered yet


get the height through this.$refs.header.offsetHeight to try


solve the problem? I also encountered whether I do not know when to finish loading

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eba81a-27e4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eba81a-27e4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?