【发布时间】:2020-10-16 05:16:35
【问题描述】:
如何避免更新存储数据后数据闪烁? 你可以在这里看到效果:
https://drive.google.com/file/d/178raL6AJiC4bpIOImnaTKh6Yf9GruTCz/view?usp=sharing
组件:
[...]
mounted() {
this.getIdeasFromBoard(this.$route.params.board_id);
},
[...]
商店:
[...]
const actions = {
getIdeasFromBoard({ commit, dispatch }, board_id) {
apiClient
.get('/ideas/' + board_id)
.then((result) => {
console.log('success');
commit("SET_IDEAS_BOARD", result.data);
})
.catch(error => {
console.log('error' + error);
alert("You have failed to log in. Try again with another credentials.");
dispatch('auth/logout', null, { root: true });
this.$router.push({ name: "public" });
});
},
[...]
我搜索了一些关于使用 api 进行错误处理的简单教程,但没有找到。
谢谢
【问题讨论】: