What does vuex store.watch() mean
ringa_lee
ringa_lee 2017-07-05 11:05:21
0
1
1256

This code appears in a vuex project:

store.watch(
    (state) => state.sessions,
    (val) => {
        console.log('CHANGE: ', val);
        localStorage.setItem('vue-chat-session', JSON.stringify(val));
        localStorage.setItem('islogin', JSON.stringify(val));
    }, {
        deep: true
    }
);

What does the code mean? Does Vuex also have watches?

ringa_lee
ringa_lee

ringa_lee

reply all(1)
洪涛

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template