JSFiddle - React, Tailwind, and code Playground

by Simon Herteby

HTML

<div id="vue">
  <div v-hax="'test'">Hax</div>
  <div v-hax="'test'">Hax</div>
  <div v-hax="'test'">Hax</div>
</div>

JavaScript

Vue.directive('hax', {
	bind(el, binding, vnode){
  	const key = binding.value
  	const vm = vnode.context
  	const ref = vnode.componentInstance || vnode.elm
    if(!Array.isArray(vm.$refs[key])){
    	vm.$refs[key] = []
    }
    vm.$refs[key].push(ref)
  }
})
new Vue({
  el: '#vue',
  mounted(){
  	console.log(this.$refs)
  }
})