Dafrok/v-hotkey

[Vue warn]: Error in directive hotkey componentUpdated hook: "TypeError: Cannot read property 'value' of undefined"

peda opened this issue · 4 comments

peda commented

Sometimes it would be neat to declare the hotkey binding inline (in the tag) - especially when you only have one binding. But in this case the error message [Vue warn]: Error in directive hotkey componentUpdated hook: "TypeError: Cannot read property 'value' of undefined" is thrown.

<my-tag v-hotkey="{ esc: cancelEdit }">
...
</my-tag>

When I use a computed (or data) variable instead of { esc: cancelEdit } everything works fine.

@peda Your code was working with version 0.3.1. I just updated the package to 0.6.0 and I get the same issue.

I encountered the same issue. It looks like v-hotkey needs a computed property to function without throwing an error.

This still works, but error is being thrown.

Yes, we ended up using a computed property everywhere to keep updating this package to its latest version.

#20 solves this.