-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to give same key to different elements example : v-shortkey="['arrowdown']" on diff elements in same component #78
Comments
this issue is similar to issue #24 |
Hi! I think that you should have only one triggered shortcut and this shortcut trigger other actions inside his method. So, can you show me your use case? |
https://codesandbox.io/embed/z26y14lny3 I am getting "failed to resolve directive:shortkey" after i added vue-shortkey in this codesandbox. Before i got in my local i have restarted the system or reopned the node command prompt the error disappeared but this is the simple use case. Arrow down should work on both divs but works last event div"in this case second div list" i have tried many ways is there anyway to remove that event after passing first div. But as u mentioned "Use Ctrl+I to Save and Print" this is whole page level or document but like this same combination keys I am unable to give on different elements. |
Let me know one thing: |
No. But y we need to trigger the arrow down on div focus as we are
specifying in div element right by giving directive as “arrowdoen” and the
v-shortkey arrowdown working only on last element right
…On Wed, Mar 20, 2019 at 6:42 PM Fagner Araujo ***@***.***> wrote:
Let me know one thing:
Did you try to trigger the arrow down only in the "div" with the focus?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#78 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ApPxw7yeB8ij3Hr4aAOgeHN6lOiYn9Q5ks5vYsdsgaJpZM4bwCZG>
.
|
I will try by giving trigger and check
On Wed, Mar 20, 2019 at 6:48 PM Madhu Latha Bandaru <madhu@adbanker.com>
wrote:
… No. But y we need to trigger the arrow down on div focus as we are
specifying in div element right by giving directive as “arrowdoen” and the
v-shortkey arrowdown working only on last element right
On Wed, Mar 20, 2019 at 6:42 PM Fagner Araujo ***@***.***>
wrote:
> Let me know one thing:
> Did you try to trigger the arrow down only in the "div" with the focus?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#78 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ApPxw7yeB8ij3Hr4aAOgeHN6lOiYn9Q5ks5vYsdsgaJpZM4bwCZG>
> .
>
|
Hello! +1 for this issue, I would definitely consider it an improvement. Since a use case was requested, here is mine: What I would like to do: With the current behaviour of vue-shortkey, I could define a global element catching the desired shortkey, and then in its handler, emit an event or use Vuex in order to transmit the information to the components, but it seems more complicated to me, without added value (especially since I have in fact more than one button per component, each triggering their own changes, and should therefore handle several types of events). What do you think? |
Hi! <template>
<div id="form-item" v-shortkey="['ctrl', 'arrowleft']" @shortkey="shortkey">
<input type="number" value="value" @input="val => $emit('input', val)" />
</div>
</template>
<script>
export default {
name: "FormItem",
props: {
item: {
type: Object,
required: true,
},
value: {
type: Number,
default: undefined,
},
},
methods: {
async shortkey () {
const prevVal = await getPreviousValue(this.item.id);
if (prevVal !== undefined) this.$emit('input', prevVal);
}
},
}
</script> When the input have the focus, trigger the ctrl + arrowleft should call the |
No description provided.
The text was updated successfully, but these errors were encountered: