zhorton34 / vuejs-validators

Javascript Validation Simplified (Usable Outside Of Vuejs)
https://cleancode.studio
4 stars 6 forks source link

Add macro method to errors prototype and setup docs for extending errors api with custom error component instance and methods. #20

Closed zhorton34 closed 4 years ago

zhorton34 commented 4 years ago

form.errors().macro( 'setComponent', function (is) { this.is = is; this.hasComponent = fn();

 this.component = function(...args) {

       if (typeof args === undefined) {
            return this.list().map(message => `<component :is="${this.is}" :message="message" />`)
       Let properties = args;
  }

// else group of items if multiple params passed.

// else one error component if single param passed });