index.vue 1005 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <uni-shadow-root class="vant-radio-group-index"><slot></slot></uni-shadow-root>
  3. </template>
  4. <script>
  5. global['__wxRoute'] = 'vant/radio-group/index'
  6. import { VantComponent } from '../common/component';
  7. VantComponent({
  8. field: true,
  9. relation: {
  10. name: 'radio',
  11. type: 'descendant',
  12. current: 'radio-group',
  13. linked(target) {
  14. this.updateChild(target);
  15. },
  16. },
  17. props: {
  18. value: {
  19. type: null,
  20. observer: 'updateChildren',
  21. },
  22. disabled: {
  23. type: Boolean,
  24. observer: 'updateChildren',
  25. },
  26. },
  27. methods: {
  28. updateChildren() {
  29. (this.children || []).forEach((child) => this.updateChild(child));
  30. },
  31. updateChild(child) {
  32. const { value, disabled } = this.data;
  33. child.setData({
  34. value,
  35. disabled: disabled || child.data.disabled,
  36. });
  37. },
  38. },
  39. });
  40. export default global['__wxComponents']['vant/radio-group/index']
  41. </script>
  42. <style platform="mp-weixin">
  43. @import '../common/index.css';
  44. </style>