1

我们在 aspx 页面上使用 office UI fabric js SearchBox 组件。我们使用了这里的示例代码。我们面临的问题是,当搜索框失去焦点时,在搜索框中输入的值被清除并变为空。甚至在他们的文档站点中也会发生同样的情况。任何观察此问题的人以及解决此问题的任何帮助。

谢谢,

4

1 回答 1

0

使用以下修复:css:

 .ms-SearchBox-field {
    padding: 6px 3px 7px 10px;
}

js:

fabric.SearchBox.prototype._handleBlur = function (event) {
    var _this = this;
    if (!this._clearOnly) {
        this._searchBox.removeEventListener("keyup", this._boundEnableClose);
        setTimeout(function () {
            if (!_this._searchBox.contains(document.activeElement) && _this._searchBoxField.value == "") {
                _this._clearSearchBox();
                _this._collapseSearchBox();
                _this.setCollapsedListeners();
            }
        }, 10);
    }
    else {
        this._searchBoxField.focus();
    }
    this._clearOnly = false;
};
于 2018-08-16T08:43:44.337 回答