<template>
<div>
<img v-directive:dynamic_literal />
</div>
</template>
E.g. dynamic_literal = 'ok' such that in custom directive:
Vue.directive('directive', {
bind(el, binding) { binding.arg // should return 'ok'
How can I use dynamic_literal as a variable or a constant whose value should be assigned under data or prop.
I tried with v-directive:{{dynamic_literal}} and :v-directive="dynamic_literal" but no use.
Thanks in advance!
working for me:
<div v-mydirective:[dynamicArg]="foo">
to access it with binding.arg
more info: https://github.com/vuejs/rfcs/blob/master/active-rfcs/0003-dynamic-directive-arguments.md
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With