Skip to content

事件侦听

$subscribe侦听

js
// 通过 store 的 $subscribe() 方法侦听 state 及其变化
talkStore.$subscribe((mutate, state) => {
    console.log(mutate, state, "talkStore里面某个参数发生变化");
    localStorage.setItem("talkStore", JSON.stringify(state.talkList));
});

Released under the MIT License.