mirror of
https://github.com/frappe/books.git
synced 2024-11-14 01:14:03 +00:00
Refactor code
This commit is contained in:
parent
8bff2e42fb
commit
5d60955856
@ -2,7 +2,7 @@
|
||||
<div class="frappe-desk row no-gutters">
|
||||
<frappe-sidebar :sidebarConfig="sidebarConfig"></frappe-sidebar>
|
||||
<frappe-main>
|
||||
<frappe-navbar :showSearch="showSearch"></frappe-navbar>
|
||||
<frappe-navbar></frappe-navbar>
|
||||
<slot></slot>
|
||||
</frappe-main>
|
||||
</div>
|
||||
@ -19,11 +19,6 @@ export default {
|
||||
FrappeMain: Main,
|
||||
FrappeNavbar: Navbar
|
||||
},
|
||||
computed: {
|
||||
showSearch() {
|
||||
return /list|edit/.test(this.$route.path)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
|
@ -53,8 +53,8 @@ export default {
|
||||
frappe.db.on(`change:${this.doctype}`, () => {
|
||||
this.updateList();
|
||||
});
|
||||
this.$root.$on('search', this.updateList)
|
||||
this.$root.$emit('newList')
|
||||
this.$root.$on('navbarSearch', this.updateList);
|
||||
this.$root.$emit('newList');
|
||||
},
|
||||
mounted() {
|
||||
this.updateList();
|
||||
|
@ -6,27 +6,34 @@
|
||||
@input="updateSearch"
|
||||
name="search"
|
||||
class="form-control shadow-none w-100"
|
||||
placeholder="Search...">
|
||||
:placeholder="_('Search...')">
|
||||
</form>
|
||||
<div class="navbar-text">HI</div>
|
||||
<div class="navbar-text">.</div>
|
||||
</nav>
|
||||
</template>
|
||||
<script>
|
||||
import { debounce } from 'lodash';
|
||||
export default {
|
||||
props: ["showSearch"],
|
||||
data() {
|
||||
return {
|
||||
searchValue: ''
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.$root.$on('newList', () => this.searchValue = '')
|
||||
},
|
||||
methods: {
|
||||
updateSearch: debounce(function() {
|
||||
this.$root.$emit("search", this.searchValue);
|
||||
}, 500)
|
||||
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>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user