From c4f7b5e7c0659468487c86d5b9221193f8dfaae0 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 22 Mar 2024 07:32:21 +0100 Subject: [PATCH] refs #7124 perf: use find instead findIndex --- src/boot/qformMixin.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/boot/qformMixin.js b/src/boot/qformMixin.js index a3e2543c4..71f5e9f6d 100644 --- a/src/boot/qformMixin.js +++ b/src/boot/qformMixin.js @@ -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(); - } - }); } }, };