V
V
Vladimir Golub2018-06-14 14:07:01
Vue.js
Vladimir Golub, 2018-06-14 14:07:01

How to access Vue properties from a jQuery script in mounted?

I create an instance of Vue. Options
var journalRequestsClient = new Vue({

data: {
                filterParam: {
                    status: 0,
                    object: 0,
                    dateStart: '',
                    dateEnd: ''
                }
}

In its mounted property I write
mounted: function () {
                this.$nextTick(function () {
                    $('.datetimepicker').datetimepicker({
                        format: 'dd.mm.yyyy hh:ii:ss',
                        autoclose:true,
                        language: 'ru'
                    })
                    .on('changeDate', function(ev) {
                        var value = $("#selectDateStart").val();
                        this.filterParam.dateStart = value;
                    });
                })
            },

How do I move this from jQuery to Vue now?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Koteezy, 2018-06-14
@RazerVG

in $nextTick: and after
self.filterParam.DateStart = value;

A
Anton Anton, 2018-06-14
@Fragster

Solution to this question: How does Vue respond to changes in value made via jQuery? fits here too.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question