Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

136
Views
Element DOM modifications in custom Vue directive

I am using a custom directive which hides or shows a component. A custom directive is used because the component's visibility is based on logic which is difficult to squeeze into a v-show condition (and there are actually many components, so it's easier to use this custom directive).

The problem is that since the custom directive directly sets the element's style.visibility and style.display, it somewhat clashes with Vue's own v-show (at least that's my explanation for why this sometimes fails). My theory is that the element is re-rendered at part of the virtual DOM rendering and thus direct style modifications in element are overridden.

Since beforeMount allows access to the vnode (beforeMount(element, binding, vnode)), it should be possible to directly modify the vnode, so any existing logic on v-show could be merged with the custom directive's logic (merged into v-show). Is that possible or advised? The Vue documentation is a little scant in that area.

Has anyone tried this before or has any ideas that could help?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!