We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[vue] 你有写过vuex中store的插件吗?
The text was updated successfully, but these errors were encountered:
Vuex 的 store 接受 plugins 选项,这个选项暴露出每次 mutation 的钩子。Vuex 插件就是一个函数,它接收 store 作为唯一参数:
Vuex
store
plugins
mutation
const myPlugin = store => { // 当 store 初始化后调用 store.subscribe((mutation, state) => { // 每次 mutation 之后调用 // mutation 的格式为 { type, payload } }); };
然后像这样使用:
const store = new Vuex.Store({ // ... plugins: [myPlugin] });
官方文档
Sorry, something went wrong.
No branches or pull requests
[vue] 你有写过vuex中store的插件吗?
The text was updated successfully, but these errors were encountered: