错误
错误代码
<form>
<input type="text" class="form-control" name="username" placeholder="请输入要查询的用户名..."
v-model="searchContent" :value="searchContent">
<input type="submit" class="btn btn-success" value="搜索" @click="search()">
</form>
vue代码
search: function () {
var _this = this;
axios.get("/managerUser/searchTeacher?searchContent=" + _this.searchContent).then(function (res) {
// 为page对象赋值
_this.page.pageSize = res.data.data.pageSize;
_this.page.pageIndex = res.data.data.pageIndex;
_this.page.totalRecords = res.data.data.totalRecords;
_this.page.totalPages = res.data.data.totalPages;
_this.page.firstPageIndex = res.data.data.firstPageIndex;
_this.page.previousPageIndex = res.data.data.previousPageIndex;
_this.page.nextPageIndex = res.data.data.nextPageIndex;
_this.page.lastPageIndex = res.data.data.lastPageIndex;
// 为teacherList对象赋值
_this.teacherList = res.data.data.list;
}).catch(function (reason) {
console.log(reason);
});
},
原因
解决
把submit改成button。
正确代码
<form>
<input type="text" class="form-control" name="username" placeholder="请输入要查询的用户名..."
v-model="searchContent" :value="searchContent">
<input type="button" class="btn btn-success" value="搜索" @click="search()">
</form>