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
/
Button.vue
79 lines (77 loc) · 1.73 KB
/
Button.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
73
74
75
76
77
78
79
<template>
<button class="mdc-button" :class="classes" :id="id" v-bind="$attrs" v-on="$listeners">
<a v-if="icon" class="material-icons mdc-button__icon">{{icon}}</a>
<slot>
{{text}}
</slot>
</button>
</template>
<script>
import { MDCRipple } from '@material/ripple'
export default {
props: {
text: {
type: String,
required: false
},
id: {
type: String,
required: false
},
icon: {
type: String,
required: false
},
raised: {
type: Boolean,
required: false
},
unelevated: {
type: Boolean,
required: false
},
stroked: {
type: Boolean,
required: false
},
dense: {
type: Boolean,
required: false
},
compact: {
type: Boolean,
required: false
},
interactive: {
type: Boolean,
required: false
}
},
data() {
return {
mdcRipple: null
}
},
computed: {
classes() {
return {
'mdc-button--raised': this.raised,
'mdc-button--unelevated': this.unelevated,
'mdc-button--stroked': this.stroked,
'mdc-button--dense': this.dense,
'mdc-button--compact': this.compact
}
}
},
mounted() {
if (this.interactive)
this.mdcRipple = new MDCRipple(this.$el)
},
destroyed() {
this.mdcRipple.destroy()
}
}
</script>
<style lang="scss">
@import "@material/button/mdc-button";
</style>