|
|
@@ -1,9 +1,14 @@
|
|
|
<template>
|
|
|
- <div v-bind="getProps">{{ props.text }}</div>
|
|
|
+ <div v-bind="getProps">
|
|
|
+ <img width="100%" height="100%" :src="defaultImg" />
|
|
|
+ <div>{{ props.text }}</div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { computed } from 'vue'
|
|
|
+import defaultImg from './image.svg'
|
|
|
+
|
|
|
const props = defineProps<{
|
|
|
width: number
|
|
|
height: number
|
|
|
@@ -17,7 +22,7 @@ const getProps = computed(() => {
|
|
|
const stateStyles = styles.find((item) => item.state === props.state)
|
|
|
|
|
|
return {
|
|
|
- class: 'button',
|
|
|
+ class: 'image-button',
|
|
|
style: {
|
|
|
width: `${props.width}px`,
|
|
|
height: `${props.height}px`,
|
|
|
@@ -30,21 +35,6 @@ const getProps = computed(() => {
|
|
|
justifyContent: stateStyles?.text?.align || 'center',
|
|
|
alignItems: 'center',
|
|
|
|
|
|
- borderRadius: `${stateStyles?.border.radius}px`,
|
|
|
- borderColor: 'transparent',
|
|
|
- borderWidth: `${stateStyles?.border.width}px`,
|
|
|
- borderTopColor: ['all', 'top'].includes(stateStyles?.border?.side)
|
|
|
- ? stateStyles?.border?.color
|
|
|
- : 'transparent',
|
|
|
- borderRightColor: ['all', 'right'].includes(stateStyles?.border?.side)
|
|
|
- ? stateStyles?.border?.color
|
|
|
- : 'transparent',
|
|
|
- borderBottomColor: ['all', 'bottom'].includes(stateStyles?.border?.side)
|
|
|
- ? stateStyles?.border?.color
|
|
|
- : 'transparent',
|
|
|
- borderLeftColor: ['all', 'left'].includes(stateStyles?.border?.side)
|
|
|
- ? stateStyles?.border?.color
|
|
|
- : 'transparent',
|
|
|
/* x 偏移量 | y 偏移量 | 阴影模糊半径 | 阴影扩散半径 | 阴影颜色 */
|
|
|
boxShodow: stateStyles?.boxShadow
|
|
|
? `${stateStyles?.boxShadow?.offsetX}px ${stateStyles?.boxShadow?.offsetY}px ${stateStyles?.boxShadow?.width}px ${stateStyles?.boxShadow?.spread}px ${stateStyles?.boxShadow?.color}`
|