Checkbox.vue 714 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <script lang="ts" setup>
  2. const isChecked = defineModel<boolean>();
  3. </script>
  4. <template>
  5. <input type="checkbox" v-model="isChecked" />
  6. </template>
  7. <style lang="less" scoped>
  8. input[type="checkbox"] {
  9. aspect-ratio: 1;
  10. height: 1em;
  11. background-color: var(--white);
  12. border: solid 1px var(--light-grey-1);
  13. appearance: none;
  14. border-radius: @border-radius;
  15. cursor: pointer;
  16. position: relative;
  17. &:checked {
  18. &:before,
  19. &:after {
  20. content: "";
  21. position: absolute;
  22. background-color: var(--primary-color);
  23. transform: rotate(45deg);
  24. }
  25. &:before {
  26. top: 16%;
  27. right: 28%;
  28. width: 16%;
  29. height: 64%;
  30. }
  31. &:after {
  32. top: 48%;
  33. left: 8%;
  34. width: 45%;
  35. height: 16%;
  36. }
  37. }
  38. }
  39. </style>