VciFormSwitch.vue 936 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <div
  3. :class="{'vfs-yes': value}"
  4. class="VciFormSwitch vci-transition"
  5. @pointerup="$emit('input', !value)"
  6. >
  7. <i
  8. class="vfs-point vci-transition-quick"
  9. ></i>
  10. </div>
  11. </template>
  12. <script>
  13. // power by visual-ceiling, at 2022/6/11 18:05
  14. export default {
  15. name: "VciFormSwitch",
  16. props: {
  17. value: {
  18. type: Boolean,
  19. default: false
  20. }
  21. },
  22. data() {
  23. return {};
  24. }
  25. };
  26. </script>
  27. <style lang="scss" scoped>
  28. .VciFormSwitch {
  29. width: 48px;
  30. height: 20px;
  31. border-radius: 16px;
  32. border: 1px solid #a4b6cc;
  33. cursor: pointer;
  34. background: rgba(#fff, 0.01);
  35. .vfs-point {
  36. display: block;
  37. width: 12px;
  38. height: 12px;
  39. box-shadow: 0 0 4px #333;
  40. border-radius: 100%;
  41. transform: translate(3px, 3px);
  42. background-color: #fff;
  43. }
  44. &.vfs-yes {
  45. background: #576b9d;
  46. .vfs-point {
  47. transform: translate(48 - 12 - 4 + px, 3px);
  48. }
  49. }
  50. }
  51. </style>