// module/user/components/field-radio/field-radio.ts
Component({
  behaviors: ['wx://form-field'],
  lifetimes: {},
  properties: {
    name: { type: String },
    value: { type: String },
    defaultValue: { type: String },
    options: { type: Array, value: [] },
  },
  data: {},
  observers: {
    'defaultValue'(value) {
      setTimeout(() => { if (!this.data.value) this.setData({ value }); }, 1000)
    }
  },
  methods: {
    onChange(event: { detail: { value: any } }) {
      const value = event.detail.value;
      this.setData({ value });
      this.triggerEvent('change', value)
    }
  }
})