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

Allow objects passed as data #471

Closed
BennyAlex opened this issue Jul 3, 2020 · 8 comments
Closed

Allow objects passed as data #471

BennyAlex opened this issue Jul 3, 2020 · 8 comments
Labels

Comments

@BennyAlex
Copy link

BennyAlex commented Jul 3, 2020

Describe the feature

It would be nice to pass an array of objects to the data prop. Than you should be able to specify the property for the value and for the marks.


eg: <vue-slider v-model="selected" :data="myObjects" value-property="importantValue" mark-property="text">

export default {
		data()  {
			return {
				selected: null,
				myObjects: [{
                                          text: 'String 2',
                                          importantValue: '2'
                                         }, {
                                             text: 'Number 1',
                                             importantValue: 1
                                         }
                               ]
			}
		}
	}

And v-model reflects the current choose, so selecting 'String 2' will change selected to '2' and 'Number 1' to 1.

selected should hold the complete object.

@NightCatSama
Copy link
Owner

Currently it can only be achieved through marks.

https://jsfiddle.net/6dsu4kjh/

This is a good idea, I will consider adding data to support the object type function.

@BennyAlex
Copy link
Author

BennyAlex commented Jul 6, 2020

@NightCatSama okay thanks.

v-model should hold the complete object then I think

@NightCatSama
Copy link
Owner

v-model supports object types that are not logical and will not be considered for implementation.

The data support object is only a simplified way of writing data + marks.

@NightCatSama
Copy link
Owner

In version 3.2.0 data already supports object types.

example: https://jsfiddle.net/NightCatSama/L5wfqgc0/2/

@BennyAlex
Copy link
Author

@NightCatSama
so you didnt know it yourself? :)

There is no documentation about it, would be nice if you could add it :D

@NightCatSama
Copy link
Owner

NightCatSama commented Jul 8, 2020

The version just updated two days ago.

document
example

@BennyAlex
Copy link
Author

Nice. On the range page, it's unclear how to archive two or more sliders, an hint that the value should be an array representing multiple sliders would be helpful :)

@NightCatSama
Copy link
Owner

Thanks for your suggestions, the documentation has been updated.

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

No branches or pull requests

2 participants