1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- import baseComponent from '../helpers/baseComponent'
- import classNames from '../helpers/classNames'
- baseComponent({
- useField: true,
- relations: {
- '../radio/index': {
- type: 'child',
- observer() {
- this.debounce(this.changeValue)
- },
- },
- },
- properties: {
- prefixCls: {
- type: String,
- value: 'wux-radio-group',
- },
- cellGroupPrefixCls: {
- type: String,
- value: 'wux-cell-group',
- },
- value: {
- type: String,
- value: '',
- observer: 'changeValue',
- },
- title: {
- type: String,
- value: '',
- },
- label: {
- type: String,
- value: '',
- },
- },
- methods: {
- changeValue(value = this.data.value) {
- const elements = this.getRelationNodes('../radio/index')
- if (elements.length > 0) {
- elements.forEach((element, index) => {
- element.changeValue(value === element.data.value, index)
- })
- }
- },
- emitEvent(item) {
- this.triggerEvent('change', { ...item, name: this.data.name })
- },
- },
- })
|