| | |
| | | <view class="c-select"> |
| | | <picker |
| | | mode="selector" |
| | | :range="range" |
| | | :range="options" |
| | | :value="current" |
| | | range-key="name" |
| | | @change="evt=>handleChange(evt.detail)" |
| | | > |
| | | <AtInput |
| | |
| | | itemData: Object, |
| | | }, |
| | | data() { |
| | | return { |
| | | optionKey: typeof this.options[0].value === 'undefined' ? 'id' : 'value', |
| | | }; |
| | | return {}; |
| | | }, |
| | | computed: { |
| | | range() { |
| | | return (this.options || []).map((item) => item.name || item[this.optionKey]); |
| | | optionKey() { |
| | | return typeof (this.options[0] || {}).value === 'undefined' ? 'id' : 'value'; |
| | | }, |
| | | current() { |
| | | const curVal = this.itemData.formData[this.itemData.name]; |