gctGenerator/site/.vuepress/components/ButtonComponent.vue

74 lines
1.3 KiB
Vue
Raw Normal View History

2020-06-28 07:05:33 +09:00
<template>
2022-02-22 12:40:14 +09:00
<div
:class="
disabled
? `button-wrapper disabled ${className ? className : ''}`
: `button-wrapper ${className ? className : ''}`
"
>
<button :class="small ? 'small' : ''" @click="handleClick" :disabled="disabled">
{{ label }}
</button>
2020-06-28 07:05:33 +09:00
</div>
</template>
<script>
export default {
props: {
2022-02-22 12:40:14 +09:00
small: { type: Boolean, required: false },
className: { type: String, required: false },
2020-06-28 07:05:33 +09:00
disabled: { type: Boolean },
onClick: { type: Function },
2020-06-29 00:35:18 +09:00
label: { type: String },
},
2022-02-22 12:40:14 +09:00
methods: {
handleClick(e) {
e.stopPropagation();
this.onClick();
},
},
2020-06-28 07:05:33 +09:00
};
</script>
<style scoped>
.button-wrapper {
position: relative;
2020-06-29 00:35:18 +09:00
display: inline-block;
2020-06-28 07:05:33 +09:00
max-width: 400px;
min-width: 180px;
2020-06-29 00:35:18 +09:00
width: 100%;
2020-06-28 07:05:33 +09:00
}
.button-wrapper.disabled button {
background-color: rgb(165, 165, 165);
cursor: not-allowed;
}
2022-02-22 12:40:14 +09:00
.small {
padding: 3px 7px;
}
2020-06-28 07:05:33 +09:00
button {
border: none;
outline: none;
background-color: #2eb9e2;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border-radius: 0;
margin: 0;
display: block;
width: 100%;
padding: 6px 15px;
font-size: 14px;
color: white;
font-weight: bold;
cursor: pointer;
2020-06-29 00:35:18 +09:00
text-align: center;
2020-06-28 07:05:33 +09:00
}
button:hover {
background-color: #3fc1e9;
}
</style>