Commit 0f58570a1fd274943289912c8c2663d297541b21
1 parent
69a84401
[Select, AutoComplete] 当选项列表中的 dropdown 在控件上部显示时,
如果选项列表的长度由外部动态变更了,dropdown 的位置会有点问题,需要重新计算.
Showing
1 changed file
with
8 additions
and
1 deletions
Show diff stats
src/components/select/select.vue
| @@ -753,7 +753,14 @@ | @@ -753,7 +753,14 @@ | ||
| 753 | }, | 753 | }, |
| 754 | visible(state){ | 754 | visible(state){ |
| 755 | this.$emit('on-open-change', state); | 755 | this.$emit('on-open-change', state); |
| 756 | - } | 756 | + }, |
| 757 | + slotOptions(options, old){ | ||
| 758 | + // 当 dropdown 在控件上部显示时,如果选项列表的长度由外部动态变更了, | ||
| 759 | + // dropdown 的位置会有点问题,需要重新计算 | ||
| 760 | + if (options && old && options.length !== old.length) { | ||
| 761 | + this.broadcast('Drop', 'on-update-popper'); | ||
| 762 | + } | ||
| 763 | + }, | ||
| 757 | } | 764 | } |
| 758 | }; | 765 | }; |
| 759 | </script> | 766 | </script> |