forked from verdnatura/salix-front
feat: split mixins
This commit is contained in:
parent
e9873a43b1
commit
c8fbef1754
|
@ -1,30 +0,0 @@
|
||||||
import { getCurrentInstance } from 'vue';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
mounted: function () {
|
|
||||||
const vm = getCurrentInstance();
|
|
||||||
if (vm.type.name === 'QForm') {
|
|
||||||
if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) {
|
|
||||||
// TODO: AUTOFOCUS IS NOT FOCUSING
|
|
||||||
const that = this;
|
|
||||||
this.$el.addEventListener('keyup', function (evt) {
|
|
||||||
if (evt.key === 'Enter') {
|
|
||||||
const input = evt.target;
|
|
||||||
if (input.type == 'textarea' && evt.shiftKey) {
|
|
||||||
evt.preventDefault();
|
|
||||||
let { selectionStart, selectionEnd } = input;
|
|
||||||
input.value =
|
|
||||||
input.value.substring(0, selectionStart) +
|
|
||||||
'\n' +
|
|
||||||
input.value.substring(selectionEnd);
|
|
||||||
selectionStart = selectionEnd = selectionStart + 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
evt.preventDefault();
|
|
||||||
that.onSubmit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -1,6 +1,8 @@
|
||||||
import { boot } from 'quasar/wrappers';
|
import { boot } from 'quasar/wrappers';
|
||||||
import qFormMixin from './qformMixin';
|
import qformEnterEvent from './qformEnterEvent';
|
||||||
|
import qformFocus from './qformFocus';
|
||||||
|
|
||||||
export default boot(({ app }) => {
|
export default boot(({ app }) => {
|
||||||
app.mixin(qFormMixin);
|
app.mixin(qformEnterEvent);
|
||||||
|
app.mixin(qformFocus);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue