- 在input上双向绑定data中input框的值
<el-input placeholder="请输入内容" v-model="queryInfo.query">
- 在input上绑定点击事件,获取页面的数据,并且输出相应的值
<el-button slot="append" icon="el-icon-search" @click="getGoodList"></el-button>
//在methods中
async getGoodList () {
const { data: res } = await this.$http.get('goods', { params: this.queryInfo })
if (res.meta.status !== 200) {
console.log(res.meta.status)
return this.$message.error('获取商品数据列表失败')
} else {
this.goodslist = res.data.goods
// 获取页面的总页数
this.total = res.data.total
}
},