Answer the question
In order to leave comments, you need to log in
Can I track the change in $refs via updated in vue?
I use nuxt because need ssr
updated(){
console.log(this.$refs['stickyHeader'].classList)
},
async mounted() { // липкое меню
await this.$nextTick(function() {
window.addEventListener("scroll", function(){
const navbar = document.getElementById("stickyHeader")
const nav_classes = navbar.classList
if(document.documentElement.scrollTop >= 150) {
if (nav_classes.contains("shrink") === false) {
nav_classes.toggle("shrink");
}
}
else {
if (nav_classes.contains("shrink") === true) {
nav_classes.toggle("shrink");
}
}
})
})
this.$nextTick().then(function () {
console.log(document.getElementById("stickyHeader").classList)
})
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question