npx skills add https://github.com/teachingai/full-stack-skills --skill vuex-vue2当用户想要以下操作时,请使用此技能:
此技能的组织结构与 Vuex 官方文档结构(https://vuex.vuejs.org/zh/、https://vuex.vuejs.org/zh/guide/、https://vuex.vuejs.org/zh/api/)相匹配。在使用 Vuex 时:
从用户的请求中识别主题:
examples/guide/installation.mdexamples/guide/quick-start.mdexamples/core-concepts/examples/advanced/广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
api/从 examples/ 目录加载相应的示例文件:
指南 :
* `examples/guide/intro.md` \- Vuex 介绍
* `examples/guide/installation.md` \- 安装指南
* `examples/guide/quick-start.md` \- 快速开始指南
* `examples/guide/what-is-vuex.md` \- 什么是 Vuex
核心概念 :
* `examples/core-concepts/state.md` \- State
* `examples/core-concepts/getters.md` \- Getters
* `examples/core-concepts/mutations.md` \- Mutations
* `examples/core-concepts/actions.md` \- Actions
* `examples/core-concepts/modules.md` \- Modules
高级 :
* `examples/advanced/plugins.md` \- 插件
* `examples/advanced/strict-mode.md` \- 严格模式
* `examples/advanced/form-handling.md` \- 表单处理
* `examples/advanced/testing.md` \- 测试
* `examples/advanced/hot-reload.md` \- 热重载
3. 遵循该示例文件中的具体说明,了解语法、结构和最佳实践
重要注意事项 :
* Vuex 适用于 Vue 2.x
* Store 是中心化的状态管理容器
* State 是响应式的
* Mutations 是同步的
* Actions 是异步的
* 每个示例文件都包含关键概念、代码示例和要点
4. 需要时参考 api/ 目录中的 API 文档:
* `api/store-api.md` \- Store API
* `api/state-api.md` \- State API
* `api/getters-api.md` \- Getters API
* `api/mutations-api.md` \- Mutations API
* `api/actions-api.md` \- Actions API
* `api/modules-api.md` \- Modules API
* `api/plugins-api.md` \- Plugins API
5. 使用 templates/ 目录中的模板:
* `templates/installation.md` \- 安装模板
* `templates/store-setup.md` \- Store 设置模板
* `templates/component-usage.md` \- 组件使用模板
Vuex 是用于 Vue.js 应用程序的状态管理模式和库。它充当应用程序中所有组件的集中式存储。
关键概念 :
使用 npm :
npm install vuex@3
使用 yarn :
yarn add vuex@3
使用 CDN :
<script src="https://unpkg.com/vuex@3"></script>
// store/index.js
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
state: {
count: 0
},
mutations: {
increment(state) {
state.count++
}
}
})
export default store
// main.js
import Vue from 'vue'
import store from './store'
new Vue({
store,
render: h => h(App)
}).$mount('#app')
examples/guide/ 或 examples/getting-started/ → https://vuex.vuejs.org/zh/guide/api/ → https://vuex.vuejs.org/zh/api/此技能包含详细的示例,其组织结构与官方文档结构相匹配。所有示例都在 examples/ 目录中(参见上面的映射)。
使用示例的方法:
使用模板的方法:
templates/ 目录中的模板以获取常见的脚手架代码详细的 API 文档可在 api/ 目录中找到,其组织结构与官方 Vuex API 文档结构(https://vuex.vuejs.org/zh/api/)相匹配:
api/store-api.md)api/state-api.md)api/getters-api.md)api/mutations-api.md)api/actions-api.md)api/modules-api.md)api/plugins-api.md)使用 API 参考的方法:
api/ 目录加载相应的 API 文件examples/ 目录中相关示例文件的链接Vuex, vuex, Vue 2, state management, 状态管理, store, state, getters, mutations, actions, modules, 存储, 状态, 获取器, 变更, 动作, 模块, Vuex store, Vuex state, Vuex getters, Vuex mutations, Vuex actions, Vuex modules, Vuex plugins, centralized state, reactive state, synchronous mutations, asynchronous actions
每周安装数
74
仓库
GitHub 星标数
226
首次出现
Jan 24, 2026
安全审计
安装于
gemini-cli64
opencode64
codex62
github-copilot61
amp55
cursor55
2025 Node.js 最佳实践指南:框架选择、架构原则与错误处理
5,100 周安装