You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

radio.vue 801 B

4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <template>
  2. <view class="cu-form-group">
  3. <view class="title">
  4. <text v-if="required" class="lr-required">*</text>
  5. {{ title }}
  6. </view>
  7. <radio
  8. @click="change"
  9. :checked="isCheck"
  10. :value="radioValue"
  11. :disabled="disabled"
  12. :class="[isCheck ? 'checked' : '', color ? color : '', point ? 'radio' : '']"
  13. ></radio>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. name: 'l-radio',
  19. props: {
  20. title: {},
  21. disabled: {},
  22. point: {},
  23. color: {},
  24. radioValue: {},
  25. value: {},
  26. required: {}
  27. },
  28. computed: {
  29. isCheck() {
  30. return this.value && this.value == this.radioValue
  31. }
  32. },
  33. methods: {
  34. change(e) {
  35. this.$emit('input', this.radioValue)
  36. this.$emit('change', this.radioValue)
  37. }
  38. }
  39. }
  40. </script>