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

how to get v-model #66

Open
raajshekhar opened this issue Feb 18, 2018 · 6 comments
Open

how to get v-model #66

raajshekhar opened this issue Feb 18, 2018 · 6 comments

Comments

@raajshekhar
Copy link

I have used this autocomplete.
i need the user selected data but here i didn't v-model, so how can i get the data

@constantm
Copy link

@raajshekhar the selected object is passed as a param with the onSelect event, eg:

:onSelect="getData"

methods: {
  getData: function(userSelectedObject) {
    console.dir(userSelectedObject);
  }
}

@molerat619
Copy link

And how do you pass another parameter to that function?

I am using this in a v-for and on select I need to assign the selected item to the respective item in the array I am iterating over. Like so:

<tr v-for="task in tasks">
     <td><autocomplete... :onSelect="getData"></autocomplete></td>
</tr>

getData needs to know which task to add the selected item to.

@yordivd
Copy link

yordivd commented Apr 3, 2018

I would like to know this as well...

@constantm
Copy link

If you're using more than one autocomplete, it might make sense to wrap them in a parent component and then keep the relevant data you'd like to access there. Otherwise, you can also add the parameter you're trying to pass to the data itself, so it gets passed to the function set with :onSelect=

@MichaelJPDX
Copy link

And, if I don't select a value but continue typing to establish a new value, how do I get the typed value to post?

@taianrj
Copy link

taianrj commented Oct 28, 2019

And, if I don't select a value but continue typing to establish a new value, how do I get the typed value to post?

I've added :on-input="inputRepository" and now it's getting the value typed.

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

6 participants