监听搜索条件,实时查询数据

dev
yujialong 3 years ago
parent d729996c05
commit 3607cfd674
  1. 13
      src/views/order/Order.vue

@ -48,8 +48,7 @@
</el-col>
<el-col :span="6">
<el-form-item>
<el-input placeholder="请输入订单号/客户名称/订单名称" prefix-icon="el-icon-search"
v-model="keyword" @keyup.enter.native="onSearch" clearable></el-input>
<el-input placeholder="请输入订单号/客户名称/订单名称" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input>
</el-form-item>
</el-col>
</el-form>
@ -154,14 +153,14 @@ export default {
pageNo: 1,
pageSize: 10,
totals: 1,
setTime: ""
searchTimer: null
};
},
watch: {
keyword: function(val) {
clearTimeout(this.setTime);
this.setTime = setTimeout(() => {
this.onSearch();
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.initData();
}, 500);
}
},
@ -273,7 +272,7 @@ export default {
this.$message.error("请先选择订单 !");
}
},
onSearch() {
initData() {
this.pageNo = 1;
this.getData();
},

Loading…
Cancel
Save