VciFormCheckbox.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <div class="VciFormCheckbox">
  3. <input
  4. :checked="checked"
  5. :name="name"
  6. type="checkbox"
  7. @input="$emit('change', $event.target.checked)"
  8. />
  9. <i class="vfc-icon vci-transition-quick vci-bg-fill"></i>
  10. </div>
  11. </template>
  12. <script>
  13. // power by visual-ceiling, at 2022/9/27 15:27
  14. export default {
  15. name: "VciFormCheckbox",
  16. model: {
  17. prop: "checked",
  18. event: "change"
  19. },
  20. props: {
  21. name: {
  22. type: String,
  23. default: "fc"
  24. },
  25. checked: {
  26. type: Boolean,
  27. default: false
  28. }
  29. },
  30. data() {
  31. return {};
  32. }
  33. };
  34. </script>
  35. <style lang="scss" scoped>
  36. .VciFormCheckbox {
  37. position: relative;
  38. width: 20px;
  39. height: 20px;
  40. .vfc-icon {
  41. position: relative;
  42. z-index: 1;
  43. display: block;
  44. width: 100%;
  45. height: 100%;
  46. opacity: 0.4;
  47. background-color: #fff;
  48. }
  49. input {
  50. position: absolute;
  51. left: 0;
  52. top: 0;
  53. z-index: 6;
  54. width: 100%;
  55. height: 100%;
  56. opacity: 0;
  57. cursor: pointer;
  58. &:checked ~ .vfc-icon {
  59. opacity: 1 !important;
  60. }
  61. }
  62. }
  63. </style>