diff --git a/site/styles/base.scss b/site/styles/base.scss index 18238d899..484cda093 100644 --- a/site/styles/base.scss +++ b/site/styles/base.scss @@ -195,7 +195,6 @@ body { pre { background-color: transparent; - overflow-x: auto; padding: 18px 24px; line-height: 1.8; font-size: 12px; diff --git a/src/select/Option.jsx b/src/select/Option.jsx index a490001f8..9e113ee66 100644 --- a/src/select/Option.jsx +++ b/src/select/Option.jsx @@ -78,8 +78,7 @@ export default class Option extends Component { queryChange(query: string) { // query 里如果有正则中的特殊字符,需要先将这些字符转义 - let parsedQuery = query.replace(/(\^|\(|\)|\[|\]|\$|\*|\+|\.|\?|\\|\{|\}|\|)/g, '\\$1'); - + const parsedQuery = query.replace(/(\^|\(|\)|\[|\]|\$|\*|\+|\.|\?|\\|\{|\}|\|)/g, '\\$1'); const visible = new RegExp(parsedQuery, 'i').test(this.currentLabel()); if (!visible) { diff --git a/src/select/Select.jsx b/src/select/Select.jsx index 0959fa629..ab1afa3e2 100644 --- a/src/select/Select.jsx +++ b/src/select/Select.jsx @@ -733,26 +733,28 @@ class Select extends Component { this.state.optionsCount++; this.state.filteredOptionsCount++; - this.setState(this.state); + this.forceUpdate(); + this.handleValueChange(); } onOptionDestroy(option: any) { this.state.optionsCount--; this.state.filteredOptionsCount--; - let index = this.state.options.indexOf(option); + const index = this.state.options.indexOf(option); if (index > -1) { this.state.options.splice(index, 1); } - this.setState(this.state, () => { - this.state.options.forEach(el => { - if (el != option) { - el.resetIndex(); - } - }); + this.state.options.forEach(el => { + if (el != option) { + el.resetIndex(); + } }); + + this.forceUpdate(); + this.handleValueChange(); } onOptionClick(option: any) {