Files
cssd-back/resources/js/vue/components/core/Toolbar.vue
T
2019-05-11 13:11:48 +04:30

159 lines
3.4 KiB
Vue

<template>
<v-toolbar
id="core-toolbar"
flat
prominent
style="background: #eee;"
>
<div class="v-toolbar-title">
<v-toolbar-title
class="tertiary--text font-weight-light"
>
<v-btn
v-if="responsive"
class="default v-btn--simple"
dark
icon
@click.stop="onClickBtn"
>
<v-icon>mdi-view-list</v-icon>
</v-btn>
{{ title }}
</v-toolbar-title>
</div>
<v-spacer />
<v-toolbar-items>
<v-flex
align-center
layout
py-2
>
<!-- <v-text-field
v-if="responsiveInput"
class="mr-4 mt-2 purple-input"
label="Search..."
hide-details
color="purple"
/> -->
<v-menu
bottom
left
content-class="dropdown-menu"
offset-y
transition="slide-y-transition">
<!-- <router-link
v-ripple
slot="activator"
class="toolbar-items"
to="/notifications"
>
<v-badge
color="error"
overlap
>
<template slot="badge">
{{ notifications.length }}
</template>
<v-icon color="tertiary">mdi-bell</v-icon>
</v-badge>
</router-link> -->
<v-card>
<v-list dense>
<v-list-tile
v-for="notification in notifications"
:key="notification"
@click="onClick"
>
<v-list-tile-title
v-text="notification"
/>
</v-list-tile>
</v-list>
</v-card>
</v-menu>
<router-link
v-ripple
class="toolbar-items"
:to="{name: 'MyInfo'}"
>
<v-icon color="tertiary">mdi-account</v-icon>
</router-link>
<v-badge v-ripple class="toolbar-items Pointer" @click.native="submitLogout" >
<v-icon color="tertiary">input</v-icon>
</v-badge>
</v-flex>
</v-toolbar-items>
</v-toolbar>
</template>
<script>
import {
mapMutations, mapActions
} from 'vuex'
export default {
data: () => ({
notifications: [
'Mike, John responded to your email',
'You have 5 new tasks',
'You\'re now a friend with Andrew',
'Another Notification',
'Another One'
],
title: null,
responsive: false,
responsiveInput: false
}),
watch: {
'$route' (val) {
this.title = val.name
}
},
mounted () {
this.onResponsiveInverted()
window.addEventListener('resize', this.onResponsiveInverted)
},
beforeDestroy () {
window.removeEventListener('resize', this.onResponsiveInverted)
},
methods: {
...mapMutations('app', ['setDrawer', 'toggleDrawer']),
...mapActions('auth', ['logout']),
onClickBtn () {
this.setDrawer(!this.$store.state.app.drawer)
},
submitLogout () {
this.logout();
},
onClick () {
//
},
onResponsiveInverted () {
if (window.innerWidth < 991) {
this.responsive = true
this.responsiveInput = false
} else {
this.responsive = false
this.responsiveInput = true
}
}
}
}
</script>
<style>
#core-toolbar a {
text-decoration: none;
}
.Pointer {
cursor: pointer;
}
</style>