列表页筛选组件,修复下拉选择取消项和值为0的项,显示异常的问题
| | |
| | | const changed = { |
| | | place: this.place, |
| | | name: this.name, |
| | | value: selectItem.value || selectItem.id, |
| | | value: undefined, |
| | | }; |
| | | if (selectItem.value || selectItem.value === 0) { |
| | | changed.value = selectItem.value; |
| | | } else if (selectItem.id) { |
| | | changed.value = selectItem.id; |
| | | } |
| | | // 显示取消项时 |
| | | if (this.cancelable) { |
| | | if (selectIndex > 0) { |
| | | this.onChange(changed); |
| | | } else { |
| | | this.onChange(); |
| | | changed.value = undefined; |
| | | this.onChange(changed); |
| | | } |
| | | } else { |
| | | } |
| | | // 正常显示时 |
| | | else { |
| | | this.onChange(changed); |
| | | } |
| | | }, |