参考:
https://blog.csdn.net/honeymoon_/article/details/118158906
解决
当建议框的内容为空的时候建议框会自己收起
<el-autocomplete
// 加一个ref
ref="autocomplete"
class="my-input"
v-model="sub"
:fetch-suggestions="querySearch"
placeholder="输入内容"
:trigger-on-focus="false"
@keyup.enter.native="search"
@select="handleSelect">
<i slot="suffix" class="el-icon-search" @click="search"></i>
</el-autocomplete>
search() {
//把suggestions置空
this.$refs.autocomplete.suggestions = [];
}