This repository has been archived by the owner on Nov 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Toolbar.vue
73 lines (69 loc) · 1.79 KB
/
Toolbar.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<template>
<div class="mdc-toolbar" :class="classes" :id="id">
<div class="mdc-toolbar__row">
<section class="mdc-toolbar__section mdc-toolbar__section--align-start">
<a class="material-icons mdc-toolbar__icon--menu" @click="toggleDrawer()">
menu
</a>
<span class="mdc-toolbar__title">{{title}}</span>
<slot name="toolbarStart" />
</section>
<section class="mdc-toolbar__section" v-if="$slots['toolbarCenter']">
<slot name="toolbarCenter" />
</section>
<section class="mdc-toolbar__section mdc-toolbar__section--align-end" v-if="$slots['toolbarEnd']">
<slot name="toolbarEnd" />
</section>
</div>
</div>
</template>
<script>
import { MDCToolbar } from '@material/toolbar'
export default {
props: {
id: {
type: String,
required: false
},
title: {
type: String,
required: false
},
fixed: {
type: Boolean,
required: false
},
waterfall: {
type: Boolean,
required: false
}
},
data() {
return {
mdcToolbar: null
}
},
mounted() {
this.mdcToolbar = new MDCToolbar(this.$el)
},
destroyed() {
this.mdcToolbar.destroy()
},
computed: {
classes() {
return {
'mdc-toolbar--fixed': this.fixed,
'mdc-toolbar--waterfall': this.waterfall
}
}
},
methods: {
toggleDrawer() {
this.$emit('toggleDrawer');
}
}
}
</script>
<style lang="scss">
@import "@material/toolbar/mdc-toolbar";
</style>