VciFormRadio.vue 1.1 KB

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