0
0
Fork 0

refs #6911 feat: qFormMixin keyup.enter

This commit is contained in:
Javier Segarra 2024-03-04 10:23:45 +01:00
parent 82e31d4dcf
commit 901c8c8f71
2 changed files with 26 additions and 0 deletions

20
src/boot/qformMixin.js Normal file
View File

@ -0,0 +1,20 @@
import { QTable, QForm } from 'quasar';
export default {
inject: { QForm },
component: { QForm },
components: { QForm },
extends: { QForm },
mounted: function () {
if (this.$el?.classList?.contains('q-form'))
if (this.$el?.id !== 'searchbarForm') {
let that = this;
document.addEventListener('keyup', function (evt) {
if (evt.keyCode === 13) {
that.onSubmit();
}
});
}
},
};

6
src/boot/quasar.js Normal file
View File

@ -0,0 +1,6 @@
import { boot } from 'quasar/wrappers';
import qFormMixin from './qformMixin';
export default boot(({ app }) => {
app.mixin(qFormMixin);
});