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

102
Views
Vue Directive get parent Proxy

My goal is to create a directive that when clicked will recursively search through parents until it's finds the first component (vnode) wih the tag role="blinkable" and trigger the function 'blink()'.

I do not know how to find the first parent of the element with the directive 'v-blink-popup'. I've added a role tag to the component incase that would help. But when looking at the el or node of the directive, the parent property is null? There has to be a way to do this.

I've created a directive called v-blink-popup...

BlinkPopup.js (global directive)

const blinkPopup = {
  bind: (el, binding, vnode) => {
    el.style.fontSize = 24 + 'px'
    el.style.backgroundColor = 'red'

    // find parent vnode
    console.log('el', el)
  }
}
export default blinkPopup 
...
Vue.directive('blink-popup', blinkPopup)

BlinkDialog.vue (component)

<template>
  <div role='blinkable'>
      <div class="bg-white rounded">
        <slot />
      </div>
  </div>
</template>

<script>
export default {
  props: {
    value: {
      type: Boolean,
      default: false,
    },
  },
  methods: {
    blink() {
      console.log('blink me')
    },
  },
}
</script>

Page.vue (page file)

<template>
  <div>
    <BlinkDialog>
      Here is my component
      <button v-blink-popup> close </button>
    </BlinkDialog>
  </div>
</template>
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!