-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
954f230
commit 90604fe
Showing
11 changed files
with
13,329 additions
and
4,046 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.vue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import Vue from "vue"; | ||
import VueAutosuggest from "../src/Autosuggest.vue"; | ||
|
||
new Vue({ | ||
el: "#app", | ||
components: { | ||
VueAutosuggest | ||
}, | ||
data() { | ||
return { | ||
suggestions: [], | ||
selected: '', | ||
clicked: '', | ||
limit: 5, | ||
autoSuggestInputId: 'autosuggest__input', | ||
results: [ | ||
{ firstname: "Frodo", lastname: "Baggins" }, | ||
{ firstname: "Samwise", lastname: "Gamgee" }, | ||
{ firstname: "Gandalf", lastname: "the Grey" }, | ||
{ firstname: "Gollum", lastname: "" }, | ||
{ firstname: "Glorfindel", lastname: "" }, | ||
{ firstname: "Galadriel", lastname: "" }, | ||
{ firstname: "Faramir", lastname: "Second Son of Denethor II" }, | ||
{ firstname: "Boromir", lastname: "First Son of Denother II" } | ||
] | ||
}; | ||
}, | ||
methods: { | ||
onInputChange(text) { | ||
this.suggestions = this.results.filter(person => { | ||
return person.firstname.toLowerCase().indexOf(text.toLowerCase()) > -1; | ||
}); | ||
}, | ||
clickHandler(e) { | ||
let value = window.document.getElementById(this.autoSuggestInputId).value; | ||
this.selected = value; | ||
} | ||
} | ||
}); |
Oops, something went wrong.