Skip to content
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

Cannot detect keyup event or hit enter event to call another function in vue js #11

Open
sanfx opened this issue Dec 28, 2018 · 3 comments

Comments

@sanfx
Copy link

sanfx commented Dec 28, 2018

I want to call a function getPatientProfile when user selects and hit enter

                            <vue-single-select
                                    v-model="patientName"
                                    :options="names"
                                    :required="true"
                                    @keyup="getPatientProfile"
                            ></vue-single-select>
        methods: {
            getPatientProfile(e){
                console.log("function got called ");
            },

but it is not working..

@sanfx sanfx changed the title Cannot detect keypress event or hit enter event to call another function in vue js Cannot detect keyup event or hit enter event to call another function in vue js Dec 28, 2018
@robrogers3
Copy link
Owner

@sanfx can you clarify what you want.
if you want another event to fire on keyup, hmm, I would have to expose setOption as a prop.
useful

@Abdillah
Copy link

Abdillah commented Mar 25, 2020

In my case a @keyup listener to the textbox is useful when we use ajax as data source.
When the user type something, we need to get the text to send into the API, then updating the list.

Without the listener, I need to touch the internals of this component, refering the textbox using id or ref.

this.$refs.singleSelect.$refs.search.on('keyup', this.updateData);

I think basic events such as focus, keyup, keydown, input, change is fine to be exposed. As this is basically a textbox + a select input.

@kamal8ali
Copy link

@sanfx Try @keyup.native

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants