[Vuejs]-How do access to vee-validate errors and clear them outside vue instance (component)

0👍

this in your callback is not Vue instance. You can try below techniques, assign var self=this

 Vue.component('add-modal', {
  template: '#add-modal-template',
  mounted() {
   var self = this;
   $(document).on('hidden.bs.modal', '.modal', function(e) {
    $(this).remove('bs.modal');
    $(this).removeData('bs.modal');
    $(".modal-body input").val(" ");
    $('.modal-body option:first').prop('selected', true);
    console.log($(this).find('.modal-body').html());
    var myBackup = $(this).find('.modal-body').html();
    $('.modal-body').empty();
    $('.modal-body').append(myBackup);

    console.log(self.errors);
    self.errors.clear()
   });
  }
 }
👤ittus

Leave a comment