0👍
You could have a start action in your vuex, and in that action you could listen the events.
Eg.
//...vuex module
// onChange is a normal function that is not inside: actions or mutations, but is declared in the samefile for ease of use
const onChange = ({commit}) => (...eventParams)=>{
commit("...", changes)
}
// Inside actions
async start({commit}){
socket.on(event, onChange({commit}))
//...you could repeat the pattern for any mutation
}
- [Vuejs]-How to access the file outside the reader.onload FileReader
- [Vuejs]-How to create a rectangle outline in vuejs without having to install any packages?
Source:stackexchange.com