| | |
| | | <template> |
| | | <view :class="['c-switch', className]"> |
| | | <AtSwitch |
| | | :title="itemData.label" |
| | | :checked="itemData.formData[itemData.name]" |
| | | :onChange="evt=>itemData.onChange(evt)" |
| | | :title="itemRes.label" |
| | | :checked="itemRes.formData[itemRes.name]" |
| | | :onChange="evt=>itemRes.onChange(evt)" |
| | | /> |
| | | </view> |
| | | </template> |
| | |
| | | name: 'CSwitch', |
| | | components: { AtSwitch }, |
| | | props: { |
| | | itemData: Object, |
| | | itemRes: Object, |
| | | }, |
| | | data() { |
| | | return {}; |
| | |
| | | computed: { |
| | | className() { |
| | | let className = ''; |
| | | if (this.itemData.required) { |
| | | if (this.itemRes.required) { |
| | | className += 'c-switch-required '; |
| | | } |
| | | if (this.itemData.error) { |
| | | if (this.itemRes.error) { |
| | | className += 'c-switch-error '; |
| | | } |
| | | return className; |