Chr*_*ris 14 javascript vue.js vuex
是否有可能订阅个别突变?
代替:
this.$store.subscribe((mutation, state) => {
if(mutation === 'someMutation'){
doSomething()
}
})
Run Code Online (Sandbox Code Playgroud)
我想要这样的东西:
this.$store.subscribe('someMutation', state => {
doSomething()
})
Run Code Online (Sandbox Code Playgroud)
小智 -5
尝试这样的事情:
this.$store.subscribe(mutation => {
if (mutation.type === 'setData') {
// do something here
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3978 次 |
| 最近记录: |