M
M
Mikhail Smirnov2019-12-24 14:31:30
JavaScript
Mikhail Smirnov, 2019-12-24 14:31:30

How to trigger the change event in js?

I am using js library Bitrix.

Added BX.calendar to the input field:

<tr><td>Дата окончания:</td><td><input v-model="active_to" @click="datepicker"></td></tr>


datepicker(event) {
                    BX.calendar({node: event.target, field: event.target, bTime: false});
                },


When you click in the field, the datepicker is displayed and when you select a date, it appears in the field.
But vue js does not see these changes, there is a value in the field, but the value does not change in the vue store.

watch also sees no changes to this active_to property:
watch: {
                active_to: function (val) {
                    console.log(val);
                },
            },

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-12-24
@tosterman82

First, don't change - v-model listens to the input event by default (add the lazy modifier if you want change to be used ).
Second, dispatchEvent .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question