我无法设法使我的组件对Vuex存储更改做出反应,但只能在我修改现有元素时进行。据我所知,它根本不应该与组件的嵌套方式有关。经过数小时的调试,尝试了一切,我所拥有的只是深入观察商店的变化...
当我在currentVisit.pathologies中添加元素时,例如:{id:1,title:“ Something”},它工作得很好,但是当我编辑元素时,我的组件对存储更新没有反应
UPDATED
addPathology: (state, payload) => {
state.currentVisit.pathologies.push(payload);
},
updatePathology: (state, payload) => {
//this is the "reduced" code, this is how I found my component doesn't react.
state.currentVisit.pathologies[0] = payload;
}
state{
currentVisit: {
id: "5",
tumors: null,
pathologies: [],
examinations: null,
allergies: null,
diagnoses: null,
comorbidities: null,
chemotherapies: null,
radiations: null,
immunotherapies: null,
operations: null
}
}
createPathology: ({ commit, getters }, payload) => {
return new Promise((resolve, reject) => {
//do axios
//then commit updatePathologies
//then return promise response
baseAxios
.post("visits/" + getters.visitId + "/pathologies", payload)
.then(res => {
commit("addPathology", res.data.data);
resolve(res);
})
.catch(e => {
reject(e);
});
});
}
editPathology: ({ commit, getters }, payload) => {
return new Promise((resolve, reject) => {
baseAxios
.patch(
"visits/" + getters.visitId + "/pathologies/" + payload.id,
payload
)
.then(res => {
//commit("updatePathology", res.data.data);
resolve(res);
})
.catch(e => {
reject(e);
});
});
}
答案 0 :(得分:3)
更改InetAddress inet = InetAddress.getByName(args[0]);
inet.isReachable(1000);
突变的反应性:
Runtime rt = Runtime.getRuntime();
Process mypro = rt.exec("ping " + args[0]);
mypro.waitFor();