2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 15:50:56 +00:00
books/ui/components/Navbar.vue

38 lines
864 B
Vue
Raw Normal View History

2018-06-27 14:38:27 +00:00
<template>
<nav class="frappe-navbar navbar navbar-light bg-light row no-gutters border-bottom">
2018-07-12 15:17:46 +00:00
<form v-if="showSearch" class="form-inline col-4 pr-3">
<input type="text"
v-model="searchValue"
@input="updateSearch"
name="search"
class="form-control shadow-none w-100"
2018-07-12 16:27:23 +00:00
:placeholder="_('Search...')">
2018-07-12 15:17:46 +00:00
</form>
2018-10-04 09:25:34 +00:00
<div class="navbar-text">&nbsp;</div>
2018-07-12 15:17:46 +00:00
</nav>
2018-06-27 14:38:27 +00:00
</template>
2018-07-12 15:17:46 +00:00
<script>
import { debounce } from 'lodash';
export default {
2018-07-12 16:27:23 +00:00
data() {
return {
searchValue: ''
};
},
computed: {
showSearch() {
// TODO: Make this configurable
return /list|edit/.test(this.$route.path)
2018-07-12 15:17:46 +00:00
}
2018-07-12 16:27:23 +00:00
},
mounted() {
this.$root.$on('newList', () => this.searchValue = '')
},
methods: {
updateSearch: debounce(function() {
this.$root.$emit('navbarSearch', this.searchValue)
}, 500)
}
2018-07-12 15:17:46 +00:00
};
</script>