File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -3,15 +3,32 @@ const template = `
33 v-if="collection"
44 class="adap-searchfield"
55 v-model="collection.search"
6- @keyup="collection.querySearch() "
6+ @keyup="search "
77 />
88`
99
1010import { Component , Prop , Vue } from 'vue-property-decorator'
1111import { PageCollection , IResource } from '@simpli/resource-collection'
1212
13+ const debounce = require ( 'lodash.debounce' )
14+
1315@Component ( { template } )
1416export class AdapSearchfield extends Vue {
1517 @Prop ( { required : true } )
1618 collection ! : PageCollection < IResource >
19+
20+ @Prop ( { type : Number , default : 1000 } )
21+ debounceTimer ! : number
22+
23+ get querySearch ( ) : ( ) => Promise < any > {
24+ return debounce ( ( ) => this . debounceQuerySearch ( ) , this . debounceTimer )
25+ }
26+
27+ async debounceQuerySearch ( ) {
28+ await this . collection . querySearch ( )
29+ }
30+
31+ async search ( ) {
32+ await this . querySearch ( )
33+ }
1734}
You can’t perform that action at this time.
0 commit comments