【发布时间】:2018-08-01 19:58:29
【问题描述】:
大家好,我正在尝试将我的商店中的状态数据添加到我在操作中的一个 axios 调用中的字符串中。这是我的商店:
export const store = new Vuex.Store
({
state: {
participants: [],
filterTags: ["foo", "swag"],
page: 1,
perPage: 2,
filterTagName: "",
}
}
这是我的行动呼吁:
actions: {
async loadParticipants ({commit}) {
try {
console.log(this.state.page);
await axios
.get('/dash/participant?perPage=2&page=1&string=f')
.then(r => r.data)
.then(participants => {
console.log(participants.docs);
console.log("Hit me");
commit('setParticipants', participants)
})
}
catch (e) {
if (e.response)
console.log(e.response);
throw e
}
}
我想在 axios 调用中的 { INSERT DATA HERE } 处添加商店的状态数据:
.get('/dash/participant?perPage={INSERT DATA HERE }&page={ INSERT DATA HERE }&string=f')
感谢您的任何意见!
【问题讨论】:
-
这需要重新标记为 vuejs2 吗?