使用:https://bootstrap-vue.js.org/docs/components/pagination
模板内容:
<b-pagination
size="md"
:total-rows="req.total"
v-model="currentPage"
:per-page="perPage"
></b-pagination>
更新产品列表的方法:
fetchData: _.debounce(function (e) {
axios.get(globalConfig.ORDERS_URL, {
params: {
limit: this.perPage,
offset: (this.currentPage === 1) ? this.currentPage - 1 : this.currentPage + 2,
name: this.name,
phone: this.phone,
from_date: this.dateOne,
to_date: this.dateTwo
},
withCredentials: true,
headers: {
'Authorization': auth.getAuthHeader()
}
})
.then((resp) => {
this.req = resp.data
console.log(resp)
})
.catch((err) => {
console.log(err)
})
}, 500),
我尝试添加@click="fireMethod"
,但无法正常工作。我该如何触发方法(使用axios从API端点解析数据),以便当用户单击分页链接时可以更新我的产品列表。