forked from verdnatura/salix-front
refs #7124 perf: use find instead findIndex
This commit is contained in:
parent
561a7a5286
commit
c4f7b5e7c0
|
@ -1,11 +1,6 @@
|
|||
import { QForm } from 'quasar';
|
||||
import { getCurrentInstance } from 'vue';
|
||||
|
||||
export default {
|
||||
inject: { QForm },
|
||||
component: { QForm },
|
||||
components: { QForm },
|
||||
extends: { QForm },
|
||||
mounted: function () {
|
||||
const vm = getCurrentInstance();
|
||||
if (vm.type.name === 'QForm')
|
||||
|
@ -14,19 +9,11 @@ export default {
|
|||
|
||||
// AUTOFOCUS
|
||||
const elementsArray = Array.from(this.$el.elements);
|
||||
const index = elementsArray.findIndex(element => element.classList.contains('q-field__native'));
|
||||
const firstInputElement = elementsArray.find(element => element.classList.contains('q-field__native'));
|
||||
|
||||
if (index !== -1) {
|
||||
const firstInputElement = elementsArray[index];
|
||||
if (firstInputElement) {
|
||||
firstInputElement.focus();
|
||||
}
|
||||
|
||||
// KEYUP Event
|
||||
document.addEventListener('keyup', function (evt) {
|
||||
if (evt.keyCode === 13) {
|
||||
that.onSubmit();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue