question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Initial selected object

See original GitHub issue
  • vue-autosuggest version: 2.2.0

hi.

How to preselect an object value?

Using the v-model, is only setting the “userinput”, but not the selected-value (and it only accept Strings)

See the forked sandbox where i try to set Gandalf at the inital, selected object, without any user-interaction. https://codesandbox.io/s/vueautosuggest-20-base-forked-cgy1s?file=/App.vue:2857-3206

This function is relevant for an project where i store the selected object in localstorage, to restore later without bother the user every time.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
p0gcommented, Mar 25, 2021

Were you able to find a solution for this?

No sorry, and i dont use this component anymore (to outdated)

0reactions
eliumoraescommented, Nov 4, 2021

I think this would be a good addition. The v-model is only for the query, not the selected item. There was some initial hackery with setChangeItem, but providing a prop or other that can set the initial item would be good. initialSelected or something, open to ideas. re: “too outdated” comment, I am curious if there is anything you feel is outdated with respect to Vue 2.x? I am currently porting it over to support Vue 3.x here: https://github.com/darrenjennings/vue-autosuggest/tree/next/v3

Hello @darrenjennings! I’m using your component and am trying to set a default value from my :suggestions list. I would like to know if you can show how to, as you said, hack it, and set the default value.

I found the solution. The component accepts v-model, you can set the default value that way.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set default selected object for select option in angular 6
I am trying set default selected object for select option in angular 6.But it's not working <select name="editUserType" class="form-select" ...
Read more >
Collecting Baseline Objects - PTC Support
Select one or more objects in the Baseline Objects table. Click the collect related objects icon on the table ... The initially selected...
Read more >
3 Ways to Set Default Value in JavaScript | SamanthaMing.com
Let's break down the 3 different ways to set Default Values using logical ... You can also use it to evaluate the selected...
Read more >
Make quick selections in Photoshop - Adobe Support
Use the Object Selection tool, Select Subject, Quick Selection, or Magic Wand tools to make quick selections in Photoshop.
Read more >
Initialize Property Values - MATLAB & Simulink - MathWorks
Classes can assign default values to properties, and you can change these values during object construction.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found