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 value-attribute in v-model? #307

Open
1 of 7 tasks
lalits2002 opened this issue Apr 16, 2020 · 2 comments
Open
1 of 7 tasks

How to get value-attribute in v-model? #307

lalits2002 opened this issue Apr 16, 2020 · 2 comments

Comments

@lalits2002
Copy link

lalits2002 commented Apr 16, 2020

I'm submitting a ...

  • support request

What is the current behavior?

How can we access id in v-model. I am getting display value in my model variable. Please help???

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

How are you importing Vue-simple-suggest?

Using the script tag.

  • ESNext (original code, single-file .vue component, css included) (import VueSimpleSuggest from 'vue-simple-suggest/lib')
  • ES6 (import VueSimpleSuggest from 'vue-simple-suggest')
  • ES7 and above (import VueSimpleSuggest from 'vue-simple-suggest/dist/es7')
  • Bundled version (import VueSimpleSuggest from 'vue-simple-suggest')
  • CommonJS (const VueSimpleSuggest = require('vue-simple-suggest'))
  • UMD Component (<script type="text/javascript" src="https://unpkg.com/vue-simple-suggest"></script>)

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • Vue.js Version: 2.5.0
  • Vue-simple-suggest version: 1.7.0
  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
  • Language: [all | TypeScript X.X | ES6/7 | ES5 | Dart]
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
@xlcrr
Copy link
Contributor

xlcrr commented Apr 27, 2020

Can you share some code? If your v-model is an object, you should replace v-model with :value and update your state manually when you select something

@bretthacker
Copy link

bretthacker commented Dec 2, 2021

I'm having this same issue, it's not clear at all. I'm returning
{ "id": "<guid>", "fullName":"Joe Blow" }
My HTML looks like this:
<vue-simple-suggest v-model="assignedUserId" value-attribute="id" display-attribute="fullName" :debounce="200" :list="searchList"> <input class="form-control" type="search" />
My data component looks like this (snipped for brevity):
data: { assignedUserId: null }

I'm assigning v-model to a model where I'm expecting the value of assignedUserId to be the guid above, while the text component displays Joe Blow on the screen. It doesn't do this. I have no idea how to retrieve the value-component and as far as I can tell, it doesn't do anything at all. Please advise. I'm also using the script tag with the umd script.

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

3 participants