Guest User

Untitled

a guest
Apr 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <template>
  2. ...
  3. <b-form-input id="search"
  4. v-model="query"
  5. type="text"
  6. placeholder="Search"
  7. v-on:keyup="find(search, query)">
  8. </b-form-input>
  9.  
  10. ....
  11.  
  12. </template>
  13.  
  14. <script type="text/javascript">
  15. export default {
  16. data() {
  17. return {
  18. options: [
  19. { text: 'All', value: 'All' },
  20. { text: 'Members', value: 'Members' },
  21. { text: 'Groups', value: 'Groups' },
  22. { text: 'Events', value: 'Events' }
  23. ],
  24. search: 'All',
  25. query: '',
  26. results: []
  27. }
  28. },
  29.  
  30. methods: {
  31. find: function (param = 'All', string = '') {
  32. axios.get('/api/search/' + param.toLowerCase() + '?query=' + string)
  33. .then(({data}) => {
  34. this.results = data.data;
  35. });
  36. }
  37. }}
  38. </script>
Add Comment
Please, Sign In to add comment