Comments (6)
Could you post a gist of your complete component?
On a side note, It sounds like you could probably skip the filterGame
remapping, and instead set a custom label:
<v-select label="name" :value.sync="form.primary_game" :options="games"></v-select>
This well tell vue-select to use game.name when creating labels.
from vue-select.
https://gist.github.com/xKairu/40be84413dad74c7173b4e95011f9dc7
I'm using Laravel Spark, if anything is confusing.
In regards to the label, what about the value? My data is stored as id/name rather than value/label, so is there an option to pick which key the plugin uses as the value too?
from vue-select.
Sorry for the delayed reply. Vue-select will simply return the entire object, no need to set a key.
I'm not sure what new SparkForm()
returns, so I can't be of much help. If add a test
property to your data object and set <v-select :value.sync="test">
, does the value sync properly?
from vue-select.
SparkForm is essentially a wrapper around vue-resource that handles processing, validation errors etc.
If I just add a test variable into my data object then swap the value binding, the test variable is then updated when I select an option from the selectbox.
If I then add this.test = this.findGame(this.user.primary_game);
into my getGames
success callback, I get the same issue as before. It acts like a one way binding and not a two way. It's this part that fails.
Everything works fine, including the picking of the game within the selectbox and having the server update the user model, except taking the ID from the user model, pulling the full object from the games array and setting the default selected item.
from vue-select.
I've been trying to sort this out for two weeks now with no result. I've found that adding a click handler to some element and having it manually update the value works, as well as setting a timeout before setting the value, so I'm thinking the issue has something to do with the order of instantiation.
However I've just now fixed it by using vm.$nextTick
like so:
this.$http.get('/api/game')
.then(response => {
this.games = response.data.data;
this.$nextTick(() => {
this.form.primary_game = this.findGame(this.user.primary_game);
});
});
from vue-select.
@kylewardnz please help me out, am having the same issue. Two way binding is not working, kindly clarify how you got it to work
from vue-select.
Related Issues (20)
- Prenvent dropdown to be close when loading Ajax option with infinite scroll
- Clear not working with :multiple option
- vue-tsc newer than 1.8.19 breaks HOT 2
- Using v-select with Vue 3 inside modal HOT 4
- vue-select with tailwind css class for longer text the search input field goes to next line.
- click event not working on a button inside no-options slot HOT 1
- Vue 2 CodePen Template in README.md is broken
- ambiguous indirect export: VueSelect HOT 1
- @input event in Vue.js 3 HOT 1
- Vue Select doesn't work on Bootstrap Modal HOT 1
- Localization not possible for aria-label & title attributes
- How to use @change/@input for changing a local value HOT 1
- Input event not being emitted HOT 1
- I'm not able to change vs--disabled background styles HOT 3
- Bug: Entered search data persists in vue-select with 'required' and 'multiple' enabled
- appendToBody="true" and dir="rtl"
- bug(docs): Codepen for the scoped slot option is broken.
- bug(animation): The fade out animation does not work when the appendToBody option is set.
- Instead of a masonry layout for multiple selected options, have one option per line
- Allow a set option to be edited
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-select.