1:给搜索框绑定改变事件
<el-form-item label="关键字" prop="name">
<el-input placeholder="请输入" clearable size="small" style="width: 240px" v-model="keyword" @change="getKeyword" />
</el-form-item>
2:在methods中调用绑定的方法
(1)this.$axios发送ajax
(2)get:请求的方式
(3)'/head/search':请求的方法
(4)params:需要传的参数
getKeyword() {
var keyword = this.keyword
this.$axios.get('/head/search', {
params: {
keyword
}
}).then(res => {
this.tableData = res.data.data
})
},