简体   繁体   English

vuex状态管理在使用Django实现多页应用程序中会有用吗?

[英]Would vuex state management be useful in implementing a multi page app with django?

I have created a single page app before with Vue and Vuex for state management and am looking into multi page apps with the django backend framework. 之前,我已经使用Vue和Vuex创建了一个单页应用程序来进行状态管理,并且正在使用django后端框架研究多页应用程序。 I am curious to know if there would be any pros to including vuex state management or would the backend take care of state management in this case? 我很好奇,想知道在包括vuex状态管理方面是否有任何优点,还是在这种情况下后端会负责状态管理?

Vuex still has use cases, even if you are navigating (and thus clearing the store) between pages. 即使您在页面之间导航(从而清除商店),Vuex仍然具有用例。

  • You can create and restore a store from localStorage, allowing you to keep a local state between pages. 您可以从localStorage创建和还原存储,从而可以在页面之间保持本地状态。 Depending on how much data you try to store in the store this may be bad for performance. 根据您尝试在存储中存储多少数据,这可能会降低性能。
  • When communicating between components, you usually do this with the prefered method of using props and events. 在组件之间进行通信时,通常使用首选的使用道具和事件的方法进行此操作。 However, when two components do not have a direct relation with each other, passing data through several components is usually a burden. 但是,当两个组件之间没有直接关系时,通过几个组件传递数据通常会很麻烦。 You can either use a vuex store to manage shared data, or use a bus to make that easier. 您可以使用vuex存储来管理共享数据,也可以使用总线来简化共享数据。

That said, you probably only want to add a store when you feel the need to have one. 就是说,您可能只想在需要时添加一家商店。 Adding a store is usually trivial. 添加商店通常很简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 实现医院管理系统的多用户类型 - implementing multi user types for hospital management system 在Django上实现多层角色 - Implementing multi layer role on Django 实施电子商务状态机(Django) - Implementing State Machine for e-Commerce (Django) 用于 Django 应用程序的 Cython:它会工作吗? - Cython for a Django app: would it work? 在 Django 中创建项目管理应用程序 - DAG 和依赖项 - Create a project management app in Django - DAGs and Dependencies 使用 django 启动库存管理应用程序的想法 - idea for starting Inventory management app with django Django管理无法从app导入方法 - Django management cannot import method from app 如何处理 django 应用程序中的管理命令异常? - How to handle management command exception in django app? Dash 应用程序 - 为多页应用程序验证动态创建布局 [错误:在 Dash 回调的“状态”中使用了不存在的对象。] - Dash app - Dynamically Create a Layout for Multi-Page App Validation [Error: A nonexistent object was used in an `State` of a Dash callback.] 单页应用程序+ REST后端中的用户管理 - User management in Single Page App + REST backend
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM