RADIO.vue 689 B

12345678910111213141516171819202122232425262728293031
  1. <template>
  2. <u-radio-group v-model="value" @change="change" :disabled="!config.writable">
  3. <u-radio v-for="(item, index) in options" :key="index" :name="item.value" :disabled="item.disabled">
  4. {{ item.label }}
  5. </u-radio>
  6. </u-radio-group>
  7. </template>
  8. <script>
  9. export default {
  10. name: 'RADIO',
  11. props: ['config', 'onChange'],
  12. data() {
  13. return {
  14. value: '',
  15. options: []
  16. }
  17. },
  18. created() {
  19. this.value = this.config.value || ''
  20. this.options = this.config.options || []
  21. },
  22. methods: {
  23. change(val) {
  24. this.onChange({ prop: this.config.formName, value: val })
  25. }
  26. }
  27. }
  28. </script>
  29. <style></style>