'VueJs Date picker @input Operation in Safari (IOS)

I made vue.js datepicker in web application.

The v-model is the value of the date parameter to be handed over to the controller, and when the date is selected, the value is changed to yyyy.mm.dd format.

Code :

<vuejs-datepicker
   v-model="params.from"
   :format="$data._datepicker.format"
   :language="_getDatepickerLanguage()"
   :disabled-dates="disabledDatesFrom"
   @input="params.from = _formatedDatepicker($event)">

_formatDatepicker :

_formatedDatepicker: function (date, format) {
    if (util.isEmpty(date)) return "";
    var f = 'YYYY.MM.DD';
    if (format) {
        if (format == 'time') f = 'HH:MM';
        else f = format;
    }
    return moment(date).format(f);
},

There is no problem in PC web, But a problem occurs in IOS WebView.

When I first select a date picker, the value is not bound. And if I choose the same date one more time, It will bind.

What I checked is as follows :

  1. As a result of checking by changing the input event to a click event, there was no need to select twice. However, the _formedDatepicker function was not executed.

  2. When the v-model option was removed, the function was operated with just one date selected as desired, and the data was returned in the format yyyy.mm.dd. However, if I choose this way, I will have a problem that cannot give the initial value.

How can I avoid the problem of having to choose the same date twice in IOS WebView while using both v-model and input events ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source