index.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <div
  3. class="__hover flex h-6 items-center justify-center gap-1 rounded-sm border-1 px-2 text-xs font-normal"
  4. :class="`${styleCpt.borderColor} ${styleCpt.bgColor} ${styleCpt.textColor}`"
  5. >
  6. <SvgIcon v-if="icon" :name="icon" :color="styleCpt.textColor" size="10" />
  7. {{ title }}
  8. </div>
  9. </template>
  10. <script setup lang="ts">
  11. defineOptions({
  12. name: 'workflowButton',
  13. })
  14. import { computed, reactive } from 'vue'
  15. const props = defineProps({
  16. icon: {},
  17. title: {},
  18. type: { default: 'main' },
  19. })
  20. const state: any = reactive({})
  21. const styleCpt = computed(() => {
  22. const obj = {
  23. borderColor: '',
  24. bgColor: '',
  25. textColor: '',
  26. }
  27. switch (props.type) {
  28. case 'main':
  29. {
  30. obj.borderColor = 'border-[var(--czr-main-color)]'
  31. obj.bgColor = 'bg-[var(--czr-main-color)]'
  32. obj.textColor = 'text-[#ffffff]'
  33. }
  34. break
  35. case 'error':
  36. {
  37. obj.borderColor = 'border-[var(--czr-error-color)]'
  38. obj.bgColor = 'bg-[var(--czr-error-color)]/10'
  39. obj.textColor = 'text-[var(--czr-error-color)]'
  40. }
  41. break
  42. }
  43. return obj
  44. })
  45. </script>
  46. <style lang="scss" scoped></style>