File tree Expand file tree Collapse file tree 6 files changed +140
-70
lines changed
docs/app/pages/Components/Autocomplete
src/components/MdAutocomplete Expand file tree Collapse file tree 6 files changed +140
-70
lines changed Original file line number Diff line number Diff line change 1
1
<example src="./examples/AutocompleteStatic.vue " />
2
+ <example src="./examples/AutocompleteTrigger.vue " />
3
+ <example src="./examples/AutocompleteSearch.vue " />
2
4
<example src="./examples/AutocompleteBox.vue " />
3
5
<example src="./examples/AutocompleteTemplate.vue " />
4
6
<example src="./examples/AutocompleteAsync.vue " />
15
17
<code-example title =" Normal and Dense" :component =" examples['autocomplete-static']" />
16
18
</div >
17
19
20
+ <div class =" page-container-section" >
21
+ <h2 >Trigger</h2 >
22
+
23
+ <code-example title =" Focus vs Input" :component =" examples['autocomplete-trigger']" />
24
+ </div >
25
+
26
+ <div class =" page-container-section" >
27
+ <h2 >Search Algorithms</h2 >
28
+
29
+ <code-example title =" Fuzzy or Normal" :component =" examples['autocomplete-search']" />
30
+ </div >
31
+
18
32
<div class =" page-container-section" >
19
33
<h2 >Box Layout</h2 >
20
34
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div >
3
+ <strong >Fuzzy Search:</strong >
4
+ <md-autocomplete v-model =" selectedCountry" :md-options =" employees" >
5
+ <label >Manager</label >
6
+
7
+ <template slot="md-autocomplete-item" slot-scope="{ item, term }">
8
+ <md-highlight-text :md-term =" term" >{{ item }}</md-highlight-text >
9
+ </template >
10
+
11
+ <template slot="md-autocomplete-empty" slot-scope="{ term }">
12
+ No countries matching "{{ term }}" were found. <a @click =" noop()" >Create a new</a > one!
13
+ </template >
14
+ </md-autocomplete >
15
+
16
+ <strong >Normal Search:</strong >
17
+ <md-autocomplete v-model =" selectedEmployee" :md-options =" countries" :md-fuzzy-search =" false" >
18
+ <label >Country</label >
19
+
20
+ <template slot="md-autocomplete-item" slot-scope="{ item, term }">
21
+ <md-highlight-text :md-term =" term" >{{ item }}</md-highlight-text >
22
+ </template >
23
+
24
+ <template slot="md-autocomplete-empty" slot-scope="{ term }">
25
+ No countries matching "{{ term }}" were found. <a @click =" noop()" >Create a new</a > one!
26
+ </template >
27
+ </md-autocomplete >
28
+ </div >
29
+ </template >
30
+
31
+ <script >
32
+ export default {
33
+ name: ' AutocompleteSearch' ,
34
+ data : () => ({
35
+ selectedCountry: null ,
36
+ selectedEmployee: null ,
37
+ countries: [
38
+ ' Algeria' ,
39
+ ' Argentina' ,
40
+ ' Brazil' ,
41
+ ' Canada' ,
42
+ ' Italy' ,
43
+ ' Japan' ,
44
+ ' United Kingdom' ,
45
+ ' United States'
46
+ ],
47
+ employees: [
48
+ ' Jim Halpert' ,
49
+ ' Dwight Schrute' ,
50
+ ' Michael Scott' ,
51
+ ' Pam Beesly' ,
52
+ ' Angela Martin' ,
53
+ ' Kelly Kapoor' ,
54
+ ' Ryan Howard' ,
55
+ ' Kevin Malone' ,
56
+ ' Creed Bratton' ,
57
+ ' Oscar Nunez' ,
58
+ ' Toby Flenderson' ,
59
+ ' Stanley Hudson' ,
60
+ ' Meredith Palmer' ,
61
+ ' Phyllis Lapin-Vance'
62
+ ]
63
+ }),
64
+ methods: {
65
+ noop () {
66
+ window .alert (' noop' )
67
+ }
68
+ }
69
+ }
70
+ </script >
71
+
72
+ <style lang="scss" scoped>
73
+ .md-autocomplete + strong {
74
+ margin-top : 36px ;
75
+ display : block ;
76
+ }
77
+ </style >
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
- <md-autocomplete v-model =" selectedCountry" :md-options =" countries" >
3
+ <md-autocomplete v-model =" selectedCountry" :md-options =" countries" :md-fuzzy-search = " false " >
4
4
<label >Country</label >
5
5
</md-autocomplete >
6
6
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div >
3
+ <md-autocomplete v-model =" selectedCountry" :md-options =" countries" >
4
+ <label >Country</label >
5
+ </md-autocomplete >
6
+
7
+ <md-autocomplete v-model =" selectedEmployee" :md-options =" employees" :md-open-on-focus =" false" >
8
+ <label >Employees</label >
9
+ </md-autocomplete >
10
+ </div >
11
+ </template >
12
+
13
+ <script >
14
+ export default {
15
+ name: ' AutocompleteStatic' ,
16
+ data : () => ({
17
+ selectedCountry: null ,
18
+ selectedEmployee: null ,
19
+ countries: [
20
+ ' Algeria' ,
21
+ ' Argentina' ,
22
+ ' Brazil' ,
23
+ ' Canada' ,
24
+ ' Italy' ,
25
+ ' Japan' ,
26
+ ' United Kingdom' ,
27
+ ' United States'
28
+ ],
29
+ employees: [
30
+ ' Jim Halpert' ,
31
+ ' Dwight Schrute' ,
32
+ ' Michael Scott' ,
33
+ ' Pam Beesly' ,
34
+ ' Angela Martin' ,
35
+ ' Kelly Kapoor' ,
36
+ ' Ryan Howard' ,
37
+ ' Kevin Malone' ,
38
+ ' Creed Bratton' ,
39
+ ' Oscar Nunez' ,
40
+ ' Toby Flenderson' ,
41
+ ' Stanley Hudson' ,
42
+ ' Meredith Palmer' ,
43
+ ' Phyllis Lapin-Vance'
44
+ ]
45
+ })
46
+ }
47
+ </script >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 4
4
<md-input
5
5
v-model =" searchTerm"
6
6
@focus.stop =" openOnFocus"
7
+ @blur =" hideOptions"
7
8
@input =" onInput"
8
9
@click.stop.prevent =" openOnFocus" />
9
10
You can’t perform that action at this time.
0 commit comments