From: Eduardo San Martin Morote Date: Wed, 15 May 2024 14:35:53 +0000 (+0200) Subject: docs: links X-Git-Tag: @pinia/nuxt@0.5.2~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a82d235acd1a6cf10e8c4db843f4a637791734af;p=thirdparty%2Fvuejs%2Fpinia.git docs: links --- diff --git a/packages/docs/cookbook/composables.md b/packages/docs/cookbook/composables.md index 45cb717b..1f65952f 100644 --- a/packages/docs/cookbook/composables.md +++ b/packages/docs/cookbook/composables.md @@ -4,6 +4,11 @@ ## Option Stores + + When defining an option store, you can call a composable inside of the `state` property: ```ts @@ -27,6 +32,11 @@ Here are some examples of composables that cannot be used in an option stores (b ## Setup Stores + + On the other hand, when defining a setup store, you can use almost any composable since every property gets discerned into state, action, or getter: ```ts diff --git a/packages/docs/cookbook/testing.md b/packages/docs/cookbook/testing.md index 4a153e8a..74b6159a 100644 --- a/packages/docs/cookbook/testing.md +++ b/packages/docs/cookbook/testing.md @@ -1,5 +1,10 @@ # Testing stores + + Stores will, by design, be used at many places and can make testing much harder than it should be. Fortunately, this doesn't have to be the case. We need to take care of three things when testing stores: - The `pinia` instance: Stores cannot work without it diff --git a/packages/docs/zh/cookbook/composables.md b/packages/docs/zh/cookbook/composables.md index 5c78efdd..bc09d418 100644 --- a/packages/docs/zh/cookbook/composables.md +++ b/packages/docs/zh/cookbook/composables.md @@ -4,6 +4,11 @@ ## Option Stores %{#option-stores}% + + 当定义一个 option store 时,你可以在 `state` 属性中调用组合式函数: ```ts @@ -27,6 +32,11 @@ export const useAuthStore = defineStore('auth', { ## Setup Stores %{#setup-stores}% + + 另外,当定义一个 setup store 时,你几乎可以使用任何组合式函数,因为每一个属性都会被辨别为 state 、action 或者 getter: ```ts diff --git a/packages/docs/zh/cookbook/testing.md b/packages/docs/zh/cookbook/testing.md index b92e9df5..cd5450f7 100644 --- a/packages/docs/zh/cookbook/testing.md +++ b/packages/docs/zh/cookbook/testing.md @@ -1,5 +1,10 @@ # store 测试 %{#testing-stores}% + + 从设计上来说,许多地方都会使用 store,所以可能比正常情况更难测试。但幸运的是,这不一定是真的。在测试 store 时,我们需要注意三件事: - `pinia` 实例:没有它,store 不能正常工作