最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - What is the difference between Vuex and Event Bus? - Stack Overflow

programmeradmin5浏览0评论

I am trying to understand the principle of munication between ponents and a doubt has arisen: what is the main difference between Vue event bus strategy and Vuex to deal with ponents munication? Besides that, when is the best time of use of each one and what is the best practice to use both in the same project?

I am trying to understand the principle of munication between ponents and a doubt has arisen: what is the main difference between Vue event bus strategy and Vuex to deal with ponents munication? Besides that, when is the best time of use of each one and what is the best practice to use both in the same project?

Share Improve this question asked Aug 29, 2018 at 19:19 AipiAipi 2,4764 gold badges19 silver badges27 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 16

the vue event bus is a separate instance of Vue. Vuex is a (flux based) state managment library that integrates with the current instance of Vue, and adds a lot of functionality.

I think you shouldn't be using the event bus at all if you can solve an issue using Vuex.

Vuex implements the flux pattern that allows ponents to easily subscribe to changes based on store mutations.

img src: https://medium./@cabot_solutions/flux-the-react-js-application-architecture-a-prehensive-study-fd2585d06483

发布评论

评论列表(0)

  1. 暂无评论