fgr-araujo / vue-shortkey

Vue-ShortKey - The ultimate shortcut plugin to improve the UX
MIT License
884 stars 101 forks source link

Is there any way to list the mapped shortkey? #118

Closed BryCur closed 4 years ago

BryCur commented 4 years ago

Hello, I tried to look in the issues already opened and closed but didn't see anything close to my question.

I mapped various shortkey across different components, and I wonder if there is a way or if it is planned to get a list of the mapped combinations present in the components used in the page.

fgr-araujo commented 4 years ago

Sometimes I am asked for a list of mapped keys and I always try to explain that the shortcuts are not part of the logic, but are part of the component that calls some logic.

even so, sometimes I see people needing to have this list in the logical part.

In these cases I suggest to the simple approach:

in Component:

:shortkey="shortcuts.openModal"

and on the logic:

export default {
  data: () => ({
    shortcuts: {
      openModal: ['shift', 'o']
    }
}

With this idea you can structure your list as you want. You can have an global file to store your list of shortcuts, put it on Vuex and etc.