Vee-validate: handleSubmit: Can you support passing parameters for the callback?

Created on 24 Feb 2020  路  2Comments  路  Source: logaretm/vee-validate

Describe the solution you'd like

async handleSubmit(cb: Function) {
  const isValid = await this.validate();
  if (!isValid || !cb) {
    return;
  }

  return cb();
},

https://github.com/logaretm/vee-validate/blob/master/src/components/Observer.ts#L188

Can you support passing parameters for the callback?

For example:

handleSubmit(submit, param1, param2);

Most helpful comment

You can easily pass whatever you want:

handleSubmit(() => submit(param1, param2))

All 2 comments

You can easily pass whatever you want:

handleSubmit(() => submit(param1, param2))

Nice workaround. However, this should be implemented maybe in a cleaner way, lets say so you can do:

@submit.prevent="handleSubmit(verifyAttribute('email'))"

Where email could be anything according to the needs.

This suggested approach throwns an error.

Was this page helpful?
0 / 5 - 0 ratings