// 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 }); const name = this.data.name; if (name) this.triggerEvent('change', { [name]: value }, { bubbles: true, composed: true }); } } })