Skip to content

Commit 3995f25

Browse files
committed
fix: select-tree throw error when showSearch #2082
1 parent 4a0d35f commit 3995f25

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

components/vc-tree-select/src/Select.jsx

+8-7
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,14 @@ const Select = {
224224
this.forcePopupAlign();
225225
});
226226
},
227-
'$data._open'() {
227+
'$data._open'(open) {
228228
this.$nextTick(() => {
229229
const { prefixCls } = this.$props;
230230
const { _selectorValueList: selectorValueList, _valueEntities: valueEntities } = this.$data;
231231
const isMultiple = this.isMultiple();
232232

233233
// Scroll to value position, only need sync on single mode
234-
if (!isMultiple && selectorValueList.length && this.popup) {
234+
if (!isMultiple && selectorValueList.length && open && this.popup) {
235235
const { value } = selectorValueList[0];
236236
const { domTreeNodes } = this.popup.getTree();
237237
const { key } = valueEntities[value] || {};
@@ -823,15 +823,16 @@ const Select = {
823823

824824
onDropdownVisibleChange(open) {
825825
const { multiple, treeCheckable } = this.$props;
826-
const { _searchValue } = this;
826+
const { _searchValue } = this.$data;
827827

828828
// When set open success and single mode,
829829
// we will reset the input content.
830830
if (open && !multiple && !treeCheckable && _searchValue) {
831-
this.setUncontrolledState({
832-
_searchValue: '',
833-
_filteredTreeNodes: null,
834-
});
831+
// 动画会有闪动,该特性先注释
832+
// this.setUncontrolledState({
833+
// _searchValue: '',
834+
// _filteredTreeNodes: null,
835+
// });
835836
}
836837
this.setOpenState(open, true);
837838
},

0 commit comments

Comments
 (0)