|
@@ -6,10 +6,11 @@ interface ComponentProps {
|
|
|
block?: boolean
|
|
|
color?: string
|
|
|
size?: 'lg' | 'md' | 'sm'
|
|
|
+ location?: 'left' | 'right'
|
|
|
}
|
|
|
const props = withDefaults(
|
|
|
defineProps<{ customClass?: string; skew?: boolean } & ComponentProps>(),
|
|
|
- { color: 'primary' },
|
|
|
+ { color: 'primary', location: 'left' },
|
|
|
)
|
|
|
const emits = defineEmits<{ click: [] }>()
|
|
|
const themeVars = { primary: '--evo-theme-primary' }
|
|
@@ -24,8 +25,8 @@ const height = computed(() => ({ lg: '2.75rem', md: '2.1875rem' })[props.size] |
|
|
|
</script>
|
|
|
<template>
|
|
|
<button
|
|
|
- class="left-skew relative bg-transparent hover:bg-transparent h-[--evo-btn-height]!"
|
|
|
- :class="`${btnClass} ${{ md: 'pl-7! pr-3.5!' }[size] || ''}`"
|
|
|
+ class="relative bg-transparent hover:bg-transparent h-[--evo-btn-height]!"
|
|
|
+ :class="`${btnClass} ${{ md: 'pl-7! pr-3.5!' }[size] || ''} skew skew-${location}`"
|
|
|
:style="{ '--color': color, '--evo-btn-height': height }"
|
|
|
:block="block"
|
|
|
@click="emits('click')"
|
|
@@ -40,7 +41,11 @@ const height = computed(() => ({ lg: '2.75rem', md: '2.1875rem' })[props.size] |
|
|
|
</template>
|
|
|
<style lang="scss">
|
|
|
/* 左侧倾斜的按钮 */
|
|
|
-
|
|
|
+// .skew {
|
|
|
+// &-right {
|
|
|
+// @apply right-skew;
|
|
|
+// }
|
|
|
+// }
|
|
|
.left-skew {
|
|
|
// @apply bg-blue-500 text-white px-6 rounded text-center relative;
|
|
|
// clip-path: polygon(12% 0%, 100% 0%, 100% 100%, 0% 100%);
|
|
@@ -56,4 +61,24 @@ const height = computed(() => ({ lg: '2.75rem', md: '2.1875rem' })[props.size] |
|
|
|
// @apply opacity-75;
|
|
|
}
|
|
|
}
|
|
|
+.skew {
|
|
|
+ @apply border-black border-1 h-11 pl-8 pr-4.75 opacity-85 box-border border-red;
|
|
|
+}
|
|
|
+.skew-left {
|
|
|
+ &::before {
|
|
|
+ @apply content-empty absolute top-0 right-5 bottom-0 left-1.25 skew-x-154 rounded-tl-1.25 rounded-bl-3.75;
|
|
|
+ }
|
|
|
+ &::after {
|
|
|
+ @apply content-empty absolute top-0 right-0 bottom-0 left-6 w-auto h-auto rounded-2.5 b-none z-0 transform-none;
|
|
|
+ }
|
|
|
+}
|
|
|
+.skew-right {
|
|
|
+ @apply pl-4.75 pr-8;
|
|
|
+ &::before {
|
|
|
+ @apply content-empty absolute top-0 right-1.25 bottom-0 left-5 skew-x-154 rounded-tr-3.75 rounded-br-1.25 border-[#b5b5b5] border-solid;
|
|
|
+ }
|
|
|
+ &::after {
|
|
|
+ @apply content-empty absolute top-0 right-6 bottom-0 left-0 w-auto h-auto rounded-2.5 rounded-tr-0 rounded-br-0 z-0 transform-none border-[#b5b5b5] b-1.5 border-solid border-r-0;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|