参考:
建议输入框el-autocomplete点击回车下拉框不消失问题
https://element.eleme.io/?cate_type=all&wd=&eqid=dc610962008b5d910000000565c42296#/zh-CN/component/input#dai-shu-ru-jian-yi
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 = [];
}