fs-switch.vue 626 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <switch
  3. class="fs-switch"
  4. :checked="checked"
  5. :color="color"
  6. :disabled="disabled"
  7. :class="[size]"
  8. @change="change">
  9. </switch>
  10. </template>
  11. <script setup>
  12. const props = defineProps({
  13. checked: Boolean,
  14. disabled: Boolean,
  15. color: String,
  16. size: {
  17. type: String,
  18. validator(value) {
  19. return ['small', 'medium'].includes(value)
  20. }
  21. }
  22. })
  23. const emits = defineEmits(['change'])
  24. const change = e => {
  25. emits('change', e.detail.value)
  26. }
  27. </script>
  28. <style lang="scss" scoped>
  29. .fs-switch{
  30. transform: scale(0.8);
  31. &.medium{
  32. transform: scale(0.6);
  33. }
  34. &.small{
  35. transform: scale(0.5);
  36. }
  37. }
  38. </style>