Created
June 4, 2018 18:34
-
-
Save gtalarico/a92121e58daaf1d7643f6e332b0a9958 to your computer and use it in GitHub Desktop.
VueJs _.debounce filtering
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
<template> | |
<input class="input is-small" type="text" placeholder="Filter" v-model="query" @keyup='doFilter'> | |
</template> | |
<script> | |
... | |
data () { | |
return { | |
this.debouncedQuery = '', | |
this.query = '' | |
, } | |
} | |
mounted () { | |
this.doFilter = _.debounce(() => { | |
self.debouncedQuery = self.query | |
}, 300) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment