490
490
491
491
### \_ StoreObject
492
492
493
- Ƭ ** \_ StoreObject** <` S ` \> : ` S ` extends [ ` StoreDefinition ` ] ( ../interfaces/pinia.StoreDefinition.md ) <infer Ids, infer State, infer Getters, infer Actions\> ? { [ Id in \` ${Ids}${MapStoresCustomization extends Record<"suffix", string\> ? MapStoresCustomization [ "suffix" ] : "Store"}\` ] : Function } : {}
493
+ Ƭ ** \_ StoreObject** <` S ` \> : ` S ` extends [ ` StoreDefinition ` ] ( ../interfaces/pinia.StoreDefinition.md ) <infer Ids, infer State, infer Getters, infer Actions\> ? { [ Id in \` ${Ids}${MapStoresCustomization extends Record<"suffix", infer Suffix extends string\> ? Suffix : "Store"}\` ] : Function } : {}
494
494
495
495
For internal use ** only** .
496
496
@@ -810,38 +810,11 @@ ___
810
810
811
811
▸ **mapGetters**<` Id` , ` S ` , ` G ` , ` A ` , ` KeyMapper` \> (` useStore` , ` keyMapper` ): [` _MapStateObjectReturn` ](pinia.md#_mapstateobjectreturn)<` Id` , ` S ` , ` G ` , ` A ` , ` KeyMapper` \>
812
812
813
- Allows using state and getters from one store without using the composition
814
- API (` setup ()` ) by generating an object to be spread in the ` computed` field
815
- of a component. The values of the object are the state properties/getters
816
- while the keys are the names of the resulting computed properties.
817
- Optionally, you can also pass a custom function that will receive the store
818
- as its first argument. Note that while it has access to the component
819
- instance via ` this ` , it won't be typed.
820
-
821
- **` Example` **
813
+ Alias for ` mapState ()` . You should use ` mapState ()` instead.
822
814
823
- ` ` ` js
824
- export default {
825
- computed: {
826
- // other computed properties
827
- // useCounterStore has a state property named `count` and a getter `double`
828
- ... mapState (useCounterStore, {
829
- n: ' count' ,
830
- triple : store => store .n * 3 ,
831
- // note we can't use an arrow function if we want to use `this`
832
- custom (store ) {
833
- return this .someComponentValue + store .n
834
- },
835
- doubleN: ' double'
836
- })
837
- },
815
+ **` Deprecated` **
838
816
839
- created () {
840
- this .n // 2
841
- this .doubleN // 4
842
- }
843
- }
844
- ` ` `
817
+ use ` mapState ()` instead.
845
818
846
819
#### Type parameters
847
820
@@ -855,36 +828,22 @@ export default {
855
828
856
829
#### Parameters
857
830
858
- | Name | Type | Description |
859
- | :------ | :------ | :------ |
860
- | ` useStore` | [` StoreDefinition` ](../interfaces/pinia.StoreDefinition.md)<` Id` , ` S ` , ` G ` , ` A ` \> | store to map from |
861
- | ` keyMapper` | ` KeyMapper` | object of state properties or getters |
831
+ | Name | Type |
832
+ | :------ | :------ |
833
+ | ` useStore` | [` StoreDefinition` ](../interfaces/pinia.StoreDefinition.md)<` Id` , ` S ` , ` G ` , ` A ` \> |
834
+ | ` keyMapper` | ` KeyMapper` |
862
835
863
836
#### Returns
864
837
865
838
[` _MapStateObjectReturn` ](pinia.md#_mapstateobjectreturn)<` Id` , ` S ` , ` G ` , ` A ` , ` KeyMapper` \>
866
839
867
840
▸ **mapGetters**<` Id` , ` S ` , ` G ` , ` A ` , ` Keys` \> (` useStore` , ` keys` ): [` _MapStateReturn` ](pinia.md#_mapstatereturn)<` S ` , ` G ` , ` Keys` \>
868
841
869
- Allows using state and getters from one store without using the composition
870
- API (` setup ()` ) by generating an object to be spread in the ` computed` field
871
- of a component.
872
-
873
- **` Example` **
842
+ Alias for ` mapState ()` . You should use ` mapState ()` instead.
874
843
875
- ` ` ` js
876
- export default {
877
- computed: {
878
- // other computed properties
879
- ... mapState (useCounterStore, [' count' , ' double' ])
880
- },
844
+ **` Deprecated` **
881
845
882
- created () {
883
- this .count // 2
884
- this .double // 4
885
- }
886
- }
887
- ` ` `
846
+ use ` mapState ()` instead.
888
847
889
848
#### Type parameters
890
849
@@ -898,10 +857,10 @@ export default {
898
857
899
858
#### Parameters
900
859
901
- | Name | Type | Description |
902
- | :------ | :------ | :------ |
903
- | ` useStore` | [` StoreDefinition` ](../interfaces/pinia.StoreDefinition.md)<` Id` , ` S ` , ` G ` , ` A ` \> | store to map from |
904
- | ` keys` | readonly ` Keys` [] | array of state properties or getters |
860
+ | Name | Type |
861
+ | :------ | :------ |
862
+ | ` useStore` | [` StoreDefinition` ](../interfaces/pinia.StoreDefinition.md)<` Id` , ` S ` , ` G ` , ` A ` \> |
863
+ | ` keys` | readonly ` Keys` [] |
905
864
906
865
#### Returns
907
866
0 commit comments