
Home | Pinia
Intuitive, type safe, light and flexible Store for Vue
介绍 | Pinia
Pinia 最初是在 2019 年 11 月左右重新设计使用 Composition API 。从那时起,最初的原则仍然相同,但 Pinia 对 Vue 2 和 Vue 3 都有效,并且不需要您使用组合 API。 除了安装和 SSR 之外,两者的 API …
或者使用 npm | Pinia
Intuitive, type safe, light and flexible Store for Vue
定义一个 Store | Pinia
Intuitive, type safe, light and flexible Store for Vue
插件 | Pinia
插件 由于是底层 API,Pania Store可以完全扩展。 以下是您可以执行的操作列表: 向 Store 添加新属性 定义 Store 时添加新选项 为 Store 添加新方法 包装现有方法 更改甚至取消操作 实现本地存储等副作 …
Actions | Pinia
与 getters 一样,操作可以通过 this 访问 whole store instance 并提供 完整类型(和自动完成 )支持。 与它们不同, actions 可以是异步的,您可以在其中 await 任何 API 调用甚至其他操作! 这是使用 …
State | Pinia
大多数时候,state 是 store 的核心部分。 我们通常从定义应用程序的状态开始。 在 Pinia 中,状态被定义为返回初始状态的函数。 Pinia 在服务器端和客户端都可以工作。
Nuxt.js | Pinia
Nuxt.js 将 Pinia 与 Nuxt.js 一起使用更容易,因为 Nuxt 在_服务器端渲染_方面处理了很多事情。 例如, 您不需要关心序列化或 XSS 攻击。 安装 确保在 pinia 旁边安装 @nuxtjs/composition-api: