this.$store.dispatch('analyzesDetail', id).then(() => {
this.temp = this.$store.state.nlp.analyzesDetail.content;
//...
});
我在analyzesDetail这个action完成以后取获得state里面的analyzesDetail,为什么还是之前的数据?
action
analyzesDetail({commit}, id){
return new Promise((resolve, reject) => {
setTimeout(() => {
request(
{
method: 'get',
url: `/agent/nlp/analyze/${id}`,
},
{type: nlpTYPE.ANALYZES_DETAIL},
{type: nlpTYPE.ANALYZES_DETAIL_ERROR, message: '获取分析详细失败'},
commit);
resolve()
}, 100)
})
},
const mutations = {
[nlpTYPE.SEGMENT] (state, payload) {
state.segment = payload;
},
[nlpTYPE.ANALYZE] (state, payload) {
state.analyze = payload;
},
[nlpTYPE.CURRENT_ANALYZE] (state, payload) {
state.currentAnalyze = payload;
},
Helenr