提交 2d77e71d 编写于 作者: WodahsOrez's avatar WodahsOrez

lxm--快速搜索框bug

上级 076ac541
......@@ -85,6 +85,15 @@ export class AppHeaderMenus extends Vue {
@Model('change', { default: '' })
protected searchValue!: string;
/**
* input绑定的搜索框值
*
* @protected
* @type {string}
* @memberof AppHeaderMenus
*/
protected inputSearchValue: string = this.searchValue;
/**
* 搜索框提示内容
*
......@@ -125,6 +134,20 @@ export class AppHeaderMenus extends Vue {
}
}
/**
* 监控searchValue
*
* @param {*} val
* @param {*} oldVal
* @memberof AppHeaderMenus
*/
@Watch('searchValue', { immediate: true })
public watchSearchValue(val: any, oldVal: any): void {
if(val && val !== this.inputSearchValue){
this.inputSearchValue = val;
}
}
/**
* 是否为模式1呈现
*
......@@ -264,12 +287,8 @@ export class AppHeaderMenus extends Vue {
* @param {*} val
* @memberof AppHeaderMenus
*/
protected searchValChange(val: any): void {
if (val) {
this.$emit('change', this.searchValue + val);
} else {
this.$emit('change', '');
}
protected searchValChange($event: any): void {
this.$emit('change', this.inputSearchValue);
}
/**
......@@ -290,7 +309,7 @@ export class AppHeaderMenus extends Vue {
searchMenu = <i-button type={this.isModeOne() ? 'text' : 'default'} shape="circle" icon="ios-search" on-click={() => this.activeSearch()} />
}
return <div class={"app-view-quick-search " + this.mode}>
<i-input v-show={this.isActiveSearch} ref="search" value={this.searchValue} autofocus autocomplete="on" search placeholder={this.searchPlaceholder} on-on-change={(e: any) => this.searchValChange(e.data)} on-on-blur={() => this.searchBlur()} on-on-search={(val: string) => this.search(val)} />
<i-input v-show={this.isActiveSearch} ref="search" v-model={this.inputSearchValue} autofocus autocomplete="on" search placeholder={this.searchPlaceholder} on-on-change={(e: any) => this.searchValChange(e)} on-on-blur={() => this.searchBlur()} on-on-search={(val: string) => this.search(val)} />
{!this.isActiveSearch ? searchMenu : null}
</div>
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册