Answer the question
In order to leave comments, you need to log in
Is it possible to pass a pointer to a vue variable into a directive?
Hello, I want to create a universal directive that changes the component variable specified when the directive is called
. For example
v-scrollDeploy:isDeployed
directives: {
scrollDeploy: {
mounted(el, binding) {
window.addEventListener("scroll", () => {
if (window.scrollY < el.offsetHeight) {
binding.instance[binding.arg] = true;
} else {
binding.instance[binding.arg] = false;
}
});
window.dispatchEvent(new Event("scroll"));
},
},
},
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