2020-10-18 18:02:22 +00:00
|
|
|
<template>
|
2021-08-03 12:52:50 +00:00
|
|
|
<button
|
|
|
|
:class="buttonClassName"
|
|
|
|
:style="buttonStyles"
|
|
|
|
:disabled="disabled"
|
|
|
|
@click="onClick"
|
|
|
|
>
|
2020-10-18 18:02:22 +00:00
|
|
|
<slot></slot>
|
|
|
|
</button>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
block: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
type: {
|
|
|
|
type: String,
|
|
|
|
default: 'blue',
|
|
|
|
},
|
|
|
|
bgColor: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
textColor: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2021-08-03 12:52:50 +00:00
|
|
|
disabled: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2020-10-18 18:02:22 +00:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
buttonClassName() {
|
|
|
|
let className = 'text-white py-3 px-4 rounded shadow-sm';
|
2021-07-13 06:01:21 +00:00
|
|
|
if (this.type === 'clear') {
|
|
|
|
className = 'flex mx-auto mt-4 text-xs w-auto text-black-600';
|
|
|
|
}
|
|
|
|
|
2020-10-18 18:02:22 +00:00
|
|
|
if (this.type === 'blue' && !Object.keys(this.buttonStyles).length) {
|
|
|
|
className = `${className} bg-woot-500 hover:bg-woot-700`;
|
|
|
|
}
|
|
|
|
if (this.block) {
|
|
|
|
className = `${className} w-full`;
|
|
|
|
}
|
|
|
|
return className;
|
|
|
|
},
|
|
|
|
buttonStyles() {
|
|
|
|
const styles = {};
|
|
|
|
if (this.bgColor) {
|
|
|
|
styles.backgroundColor = this.bgColor;
|
|
|
|
}
|
|
|
|
if (this.textColor) {
|
|
|
|
styles.color = this.textColor;
|
|
|
|
}
|
|
|
|
return styles;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onClick(e) {
|
|
|
|
this.$emit('click', e);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|