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

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

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

Loading…
Cancel
Save