vue-single-select
Advanced tools
Comparing version 1.0.8 to 1.0.9
{ | ||
"name": "vue-single-select", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "single select autocomplete dropdown for vue", | ||
@@ -5,0 +5,0 @@ "main": "single-select.vue", |
@@ -10,3 +10,3 @@ # vue-single-select | ||
vue-single-select provides a **simple** interface to replace regular select elements with an auto-complete select like Chosen for jquery. | ||
vue-single-select provides a **simple** interface to replace regular select elements with an auto-complete select element like Chosen for jQuery. | ||
@@ -89,3 +89,3 @@ ## What It Does Not Do | ||
initial="seed me" | ||
you-only-want-20-options-to-show="sure" | ||
you-only-want-20-options-to-show="is 20 enough?" | ||
:max-results="20" | ||
@@ -133,3 +133,3 @@ ></vue-single-select> | ||
/* note that there is no default styling for required input. */ | ||
/* note that there is subtle default styling for required input. */ | ||
.required { | ||
@@ -158,3 +158,2 @@ color: #721c24; | ||
- tab for selecting options | ||
- up and down arrows for selecting options | ||
@@ -169,4 +168,8 @@ - enter to select first match | ||
5. Mine just looks nicer | ||
5. It works for regular 'POST backs' to the server. | ||
If you are doing a regular post or just gathering the form data you don't need to do anything extra to provide a name and value for the selected option. | ||
5. Mine just looks nicer | ||
6. It's simple!! | ||
@@ -176,2 +179,4 @@ | ||
There are more props than I'd like. But I needed them so you might too. | ||
``` | ||
@@ -182,3 +187,4 @@ props: { | ||
}, | ||
//Give your input a name. Good for POSTS | ||
// Give your element a name. | ||
// Good for doing a POST | ||
name: { | ||
@@ -189,3 +195,3 @@ type: String, | ||
}, | ||
//Your list of options for the dropdown | ||
// Your list of things for the select | ||
options: { | ||
@@ -196,3 +202,4 @@ type: Array, | ||
}, | ||
//options can have a label, but not necessary | ||
// Tells vue-single-select what key to use | ||
// for generating option labels | ||
optionLabel: { | ||
@@ -203,3 +210,5 @@ type: String, | ||
}, | ||
//options can have a value, | ||
// Tells vue-single-select the value | ||
// you want populated in the select for the | ||
// input | ||
optionKey: { | ||
@@ -213,3 +222,3 @@ type: String, | ||
required: false, | ||
default: () => "" | ||
default: () => "Search Here" | ||
}, | ||
@@ -221,3 +230,3 @@ maxHeight: { | ||
}, | ||
//give your elements an id | ||
//Give your input an html element id | ||
inputId: { | ||
@@ -228,3 +237,2 @@ type: String, | ||
}, | ||
//use these to override the styling | ||
classes: { | ||
@@ -242,3 +250,3 @@ type: Object, | ||
}, | ||
//you can set an initial value. | ||
// Seed search text with initial value | ||
initial: { | ||
@@ -249,3 +257,2 @@ type: String, | ||
}, | ||
//this helps you manage required input | ||
required: { | ||
@@ -256,3 +263,2 @@ type: Boolean, | ||
}, | ||
//the max number of matching results that should appear in the drop down | ||
maxResults: { | ||
@@ -262,4 +268,45 @@ type: Number, | ||
default: () => 30 | ||
}, | ||
tabindex: { | ||
type: String, | ||
required: false, | ||
default: () => { | ||
return ""; | ||
} | ||
}, | ||
// Tell vue-single-select what to display | ||
// as the selected option | ||
getOptionDescription: { | ||
type: Function, | ||
default(option) { | ||
if (this.optionKey && this.optionLabel) { | ||
return option[this.optionKey] + " " + option[this.optionLabel]; | ||
} | ||
if (this.optionLabel) { | ||
return option[this.optionLabel]; | ||
} | ||
if (this.optionKey) { | ||
return option[this.optionKey]; | ||
} | ||
return option; | ||
} | ||
}, | ||
// Use this to actually give vue-single-select | ||
// a value for doing a POST | ||
getOptionValue: { | ||
type: Function, | ||
default(option) { | ||
if (this.optionKey) { | ||
return option[this.optionKey]; | ||
} | ||
if (this.optionLabel) { | ||
return option[this.optionLabel]; | ||
} | ||
return option; | ||
} | ||
} | ||
``` | ||
} | ||
``` | ||
@@ -266,0 +313,0 @@ ## Q&A |
Sorry, the diff of this file is not supported yet
26552
5
317