vuex README

The project's README from github.com/vuejs/vuex. As one markdown file: README.md.

Vuex

npm ci status


Pinia is now the new default

The official state management library for Vue has changed to Pinia. Pinia has almost the exact same or enhanced API as Vuex 5, described in Vuex 5 RFC. You could simply consider Pinia as Vuex 5 with a different name. Pinia also works with Vue 2.x as well.

Vuex 3 and 4 will still be maintained. However, it's unlikely to add new functionalities to it. Vuex and Pinia can be installed in the same project. If you're migrating existing Vuex app to Pinia, it might be a suitable option. However, if you're planning to start a new project, we highly recommend using Pinia instead.


Vuex is a state management pattern + library for Vue.js applications. It serves as a centralized store for all the components in an application, with rules ensuring that the state can only be mutated in a predictable fashion. It also integrates with Vue's official devtools extension to provide advanced features such as zero-config time-travel debugging and state snapshot export / import.

Learn more about Vuex at "What is Vuex?", or get started by looking into full documentation.

Documentation

To check out docs, visit vuex.vuejs.org.

Examples

You may find example applications built with Vuex under the examples directory.

Running the examples:

$ npm install
$ npm run dev # serve examples at localhost:8080

Questions

For questions and support please use the Discord chat server or the official forum. The issue list of this repo is exclusively for bug reports and feature requests.

Issues

Please make sure to read the Issue Reporting Checklist before opening an issue. Issues not conforming to the guidelines may be closed immediately.

Changelog

Detailed changes for each release are documented in the release notes.

Stay In Touch

For latest releases and announcements, follow on Twitter: @vuejs.

Contribution

Please make sure to read the Contributing Guide before making a pull request.

License

MIT

Copyright (c) 2015-present Evan You

vuex (vuejs/vuex)

Searching Database…

28.3K ·GitHub
这是什么?Vuex 是一个面向 Vue.js 应用的状态管理模式和库:所有组件共享一个集中式的 store,状态只能以可预测的方式修改。
Vuex 是一个独立工具,还是我加到 Vue 应用里的一个库?是一个接入 Vue 应用的库,不是单独运行的程序。每个组件都从同一个共享的 store 读取数据,并且有一套规则保证状态只能以可预测的方式被修改。
我怎么把它加到项目里?文档在哪里?在你的 Vue 项目中安装 vuex 这个 npm 包,然后按照 vuex.vuejs.org 上的指南操作。仓库的 examples 目录下还附带可以直接运行的示例应用。
除了 Vue 本身,Vuex 还需要别的东西才能运行吗?不需要。它唯一的运行时依赖是 @vue/devtools-api 这个包,用于和 Vue 官方的 devtools 浏览器扩展集成。
README 说 Pinia 是新的默认选择——如果我正在考虑用 Vuex,这意味着什么?Vuex 已进入维护模式:3 和 4 版本仍在维护,但基本不会再有新功能。官方强烈建议新项目使用 Pinia,所以 Vuex 主要适合已有的应用。
Pinia 是什么?就是那个被推荐的替代品吗?它是 Vue 目前官方的状态管理库。它的 API 和当初规划的 Vuex 5 几乎一样,或者说就是 Vuex 5 计划内容的增强版,可以把它看作换了名字的 Vuex 5,而且它也支持 Vue 2.x。
devtools 集成到底能给我带来什么?零配置的时间旅行调试——可以逐步回退查看状态变化——还能导出和导入状态快照,这些都通过 Vue 官方的 devtools 扩展实现。
在接入我自己的应用之前,我能先试用一下吗?可以。仓库的 examples 目录下有示例应用,运行 npm run dev 就能启动一个本地示例服务器(node examples/server.js,端口 8080)。
我有一个现成的 Vuex 应用——迁移到 Pinia 现实吗?现实,而且不用着急:Vuex 和 Pinia 可以装在同一个项目里,README 称这是把现有 Vuex 应用迁移到 Pinia 的合适方式。
What are similar projects?formily, core, vue, nuxt, hyperapp, taro, zustand, relay
Creator
vuejs
Size
16.2 MB
Stars
28.3K
Age
11y
Commits · 90 Days