fritx/vue-at

event when user press @

faraztanveer opened this issue · 2 comments

An event when user press '@'. I want to get members list from server side so when user press @ i will update the list of members.
i tried @at event as explained in this issue #16 but this event triggers whenever key is pressed.

Example:
**when "hello @username" is entered. event should trigger when @ is pressed and i get 'username' value only, not hello @username **

fritx commented

@faraztanveer hey which version of vue-at do you use?

I could not reproduce it on my side (vue-at 2.5.0-beta.2),
but you can also try passing <at :allow-spaces="false">,
that would avoid allowing spaces included in the chunk like

# input
Hello @name foo bar

# emits
- @at chunk='n'
- @at chunk='na'
- @at chunk='nam'
- @at chunk='name'

# while with the default prop allow-spaces=true
- ...
- @at chunk='name'
- @at chunk='name '
- @at chunk='name f'
- @at chunk='name fo'
- @at chunk='name foo'
- @at chunk='name foo '
- @at chunk='name foo b'
- ...

PS: each of the above event would be triggered once or twice, which could be improved

@fritx thank you 👍