forked from verdnatura/salix-front
Merge branch 'dev' into testToDev
This commit is contained in:
commit
a382d8278c
|
@ -0,0 +1,23 @@
|
||||||
|
import routes from 'src/router/modules';
|
||||||
|
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
export default {
|
||||||
|
mounted: function () {
|
||||||
|
const router = useRouter();
|
||||||
|
const keyBindingMap = routes
|
||||||
|
.filter((route) => route.meta.keyBinding)
|
||||||
|
.reduce((map, route) => {
|
||||||
|
map[route.meta.keyBinding.toLowerCase()] = route.path;
|
||||||
|
return map;
|
||||||
|
}, {});
|
||||||
|
const handleKeyDown = (event) => {
|
||||||
|
const { ctrlKey, altKey, key } = event;
|
||||||
|
event.preventDefault();
|
||||||
|
if (ctrlKey && altKey && keyBindingMap[key]) {
|
||||||
|
router.push(keyBindingMap[key]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('keydown', handleKeyDown);
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,6 +1,8 @@
|
||||||
import { boot } from 'quasar/wrappers';
|
import { boot } from 'quasar/wrappers';
|
||||||
import qFormMixin from './qformMixin';
|
import qFormMixin from './qformMixin';
|
||||||
|
import mainShortcutMixin from './mainShortcutMixin';
|
||||||
|
|
||||||
export default boot(({ app }) => {
|
export default boot(({ app }) => {
|
||||||
app.mixin(qFormMixin);
|
app.mixin(qFormMixin);
|
||||||
|
app.mixin(mainShortcutMixin);
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default {
|
||||||
title: 'routes',
|
title: 'routes',
|
||||||
icon: 'vn:delivery',
|
icon: 'vn:delivery',
|
||||||
moduleName: 'Route',
|
moduleName: 'Route',
|
||||||
|
keyBinding: 'r',
|
||||||
},
|
},
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'RouteMain' },
|
redirect: { name: 'RouteMain' },
|
||||||
|
|
Loading…
Reference in New Issue