Open
Description
I'd like to call a method or emit an event from a click even in the schema but this
is undefined. Is there a way to do this with this plugin? Example below
data() {
return {
schema: [
{
type: 'text',
label: 'Email',
name: 'email',
validation: 'bail|required|email',
},
{
type: 'password',
label: 'Password',
name: 'password',
validation: 'required',
},
{
component: 'div',
class: 'flex align-center justify-between',
children: [
{
type: 'submit',
label: 'Login',
},
{
type: 'button',
name: 'forgot-password',
label: 'Forgot Password',
on: {
click() {
console.log(this); //undefined
},
},
},
],
},
],
};
},
Metadata
Metadata
Assignees
Labels
No labels
Activity
gahabeen commentedon Sep 28, 2020
Hey @lsbyerley, sorry for the delay. Been off-grid last week!
I'll have a look.
hmaesta commentedon Sep 28, 2020
@gahabeen This one was not opened by me 😅
gahabeen commentedon Sep 28, 2020
Sorry about that ping ;P
gahabeen commentedon Oct 6, 2020
@lsbyerley So far there is no context bound to the event function.
Feel free to dive into it to add this feature if you want to.
https://github.com/gahabeen/vue-formulate-extended/blob/master/src/features/form-events.js
Pull requests are always appreciated.
I'm also here if you've got any question.
cjcrawford commentedon Oct 12, 2020
@lsbyerley if you're using ES6 you can simply change your syntax slightly to get access to your vm (this) if that's what you're after...