92 lines
1.9 KiB
Vue
92 lines
1.9 KiB
Vue
<template>
|
|
<button
|
|
class="app-button"
|
|
:class="[
|
|
`app-button--${type}`,
|
|
{ 'app-button--block': block, 'app-button--disabled': disabled },
|
|
]"
|
|
:disabled="disabled"
|
|
:aria-label="label"
|
|
:hover-class="disabled ? 'none' : 'app-button--pressed'"
|
|
@click="handleClick"
|
|
>
|
|
<image class="app-button__skin" :src="skin" mode="aspectFit" />
|
|
<text class="app-button__label"
|
|
><slot>{{ label }}</slot></text
|
|
>
|
|
</button>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { computed } from "vue";
|
|
|
|
const props = defineProps({
|
|
label: { type: String, default: "" },
|
|
type: { type: String, default: "primary" },
|
|
block: { type: Boolean, default: false },
|
|
disabled: { type: Boolean, default: false },
|
|
});
|
|
const emit = defineEmits(["click"]);
|
|
|
|
const skin = computed(() =>
|
|
props.type === "secondary"
|
|
? "/static/assets/foundation/transparent/a01-scroll-secondary-v3.png"
|
|
: "/static/assets/foundation/transparent/a01-scroll-primary-v3.png",
|
|
);
|
|
|
|
const handleClick = (event) => {
|
|
if (!props.disabled) emit("click", event);
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.app-button {
|
|
display: inline-grid;
|
|
width: 420rpx;
|
|
max-width: 100%;
|
|
min-height: 88rpx;
|
|
place-items: center;
|
|
box-sizing: border-box;
|
|
margin: 0;
|
|
padding: 0;
|
|
border: 0;
|
|
background: transparent;
|
|
line-height: normal;
|
|
}
|
|
.app-button::after {
|
|
border: 0;
|
|
}
|
|
.app-button--block {
|
|
display: grid;
|
|
width: 100%;
|
|
}
|
|
.app-button__skin {
|
|
width: 100%;
|
|
height: 100%;
|
|
pointer-events: none;
|
|
}
|
|
.app-button__skin,
|
|
.app-button__label {
|
|
grid-area: 1 / 1;
|
|
}
|
|
.app-button__label {
|
|
z-index: 1;
|
|
padding: 0 38rpx;
|
|
color: #fffaf0;
|
|
font-size: 29rpx;
|
|
font-weight: 700;
|
|
letter-spacing: 3rpx;
|
|
text-align: center;
|
|
}
|
|
.app-button--secondary .app-button__label {
|
|
color: #5c4330;
|
|
}
|
|
.app-button--disabled {
|
|
opacity: 0.48;
|
|
}
|
|
.app-button--pressed {
|
|
opacity: 0.78;
|
|
transform: translateY(1rpx);
|
|
}
|
|
</style>
|