van-search:在输入框输入数据,当在PC端点击回车开始搜索,在手机端点击输入法中的搜索开始搜索,
@Watch:主要用于当点击取消或删除输入框中的数据监听数据的变化
.vue
<van-searchv-model="keywordSubordinate"placeholder="请输入搜索关键词"@search="querySubordinateList"/>
.ts
private keywordSubordinate = "";@Watch("keywordSubordinate")onkeywordSubordinateChanged(newVal: string, oldVal: string) {if (!newVal || newVal === "") { //当输入框为空时this.querySubordinateList();}}private querySubordinateList() {}