Closed calebeaires closed 1 year ago
Would love to see Vue 3 support, this library is extremely useful.
Ok!! I will look at this asap.
Any update? Do you need help with a concrete PR?
Have raised a pull request, and have also published an npm package vue-three-shortkey to use in the meantime until the PR is merged.
@danielelkington
Adding your fork into my project and I can see that it also adds custom-event-polyfill
in the lib's package.json and I understand this polyfill was necessary in Vue 2 to support IE but in Vue 3 it is only meant to be used with greener browser so the polyfill could be dropped. It would be nice if you could do another update and drop that line and the use of it on this line. Cheers and thanks for the quick temp fork, I'm now using it
Thanks for the tip @ghiscoding; have released 4.0.1 of vue-three-shortkey without this polyfill.
I've found (when using vueuse), this package isn't strictly needed. Vueuse has a function named useMagicKeys
which returns an object of refs for each key combo, which can be watched.
Quick example of usage:
import { watch } from "vue";
import { useMagicKeys } from "@vueuse/core";
const { escape } = useMagicKeys();
watch(escape, (v) => {
if (v) {
console.log("Escape was pressed");
}
});
Hi. I wonder when are you going to offer support to Vue 3. I had look at your code and seen that something can be done:
This is the breaking changes from vue 2/3 https://v3.vuejs.org/guide/migration/custom-directives.html#custom-directives