V
V
vism2017-10-19 00:15:11
Vue.js
vism, 2017-10-19 00:15:11

How to pass a value from a directive to a component?

component part:

<input :name="'bankingsInput['+index+'][invoice_date]'" type="text" v-model="row.invoice_date" class="form-control" v-datetimepicker="row.invoice_date">

directive
Vue.directive('datetimepicker', {
            bind: function (el, binding, vnode) {
                console.log(this)
                console.log(vnode)
                $(el).datetimepicker(datetimepickerDefaults)
                $(el).data('DateTimePicker').date(moment(binding.value, 'DD.MM.YYYY'))
                $(el).on('dp.change', function (event) {
                    vnode.context.$emit('input', event.date || null);
                });
            }
        });

the value does not change...
And yes, I understand that this is done by the component. I want to understand why the directive does not work.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question