Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <template>
- ...
- <b-form-input id="search"
- v-model="query"
- type="text"
- placeholder="Search"
- v-on:keyup="find(search, query)">
- </b-form-input>
- ....
- </template>
- <script type="text/javascript">
- export default {
- data() {
- return {
- options: [
- { text: 'All', value: 'All' },
- { text: 'Members', value: 'Members' },
- { text: 'Groups', value: 'Groups' },
- { text: 'Events', value: 'Events' }
- ],
- search: 'All',
- query: '',
- results: []
- }
- },
- methods: {
- find: function (param = 'All', string = '') {
- axios.get('/api/search/' + param.toLowerCase() + '?query=' + string)
- .then(({data}) => {
- this.results = data.data;
- });
- }
- }}
- </script>
Add Comment
Please, Sign In to add comment