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

224
Views
how to watch props change by using custom directive like component

provide any channel to watch props change in directive

<div v-custom-dir="{ a }"></div>

app.directive("custom-dir", {
  // support `props` 
  props: ["a"],
  // add `props` arguments when mounted or provide setup hook
  mounted(props) {
     // watch props change
     watch(() => props.a, console.log)
  }
})

l know using component can resolve it,but l need to modify DOM,it will append an extra node,and change it's behavior when props was changed

now l depend on update hook,it will emit when parent updated

app.directive("custom-dir", {
   update(el, { value }){
     if(value.a === "b"){
         // do something
       }
  }
})

Is there any other way?

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!