mirror of
https://github.com/frappe/books.git
synced 2024-11-10 15:50:56 +00:00
40 lines
896 B
Vue
40 lines
896 B
Vue
<template>
|
|
<nav class="frappe-navbar navbar navbar-light bg-light row no-gutters border-bottom border-top">
|
|
<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"
|
|
:placeholder="_('Search...')">
|
|
</form>
|
|
<div class="navbar-text">.</div>
|
|
</nav>
|
|
</template>
|
|
<script>
|
|
import { debounce } from 'lodash';
|
|
export default {
|
|
props: ['showSearch'],
|
|
data() {
|
|
return {
|
|
searchValue: ''
|
|
};
|
|
},
|
|
computed: {
|
|
showSearch() {
|
|
// TODO: Make this configurable
|
|
return /list|edit/.test(this.$route.path)
|
|
}
|
|
},
|
|
mounted() {
|
|
this.$root.$on('newList', () => this.searchValue = '')
|
|
},
|
|
methods: {
|
|
updateSearch: debounce(function() {
|
|
this.$root.$emit('navbarSearch', this.searchValue)
|
|
}, 500)
|
|
}
|
|
};
|
|
</script>
|
|
|