In iView, all UI elements are rendered by return data of "render" function, for example , i have the following data:
h('Button', {
props: {
type: 'warning',
size: 'small',
disabled: params.row.disabled
},
style: {
marginTop: '5px',
marginRight: '5px',
marginBottom: '5px'
},
on: {
click: () => {
this.checkDataOne(params.row);
}
}
}, 'check data')
which will show a button. I want to disable this button on the beginning of click event, and enable it in the end(there's an asynchronous operation in checkDataOne function). But how can i get the button?
I tried "window.event.srcElement", but it return a span element, which is enclosed in the button.
If you can use
window.event.srcElementto get thespanelement inside the button, you can look for the closestbuttonelement surrounding it.So your code to get the source element would become:
You can change the
"button"to any specific selector you need in order to target the button.