vuex-composition-api
v3.0.0
Published
Make Vuex modules with syntax inspired by @vue/composition-api
Downloads
10
Maintainers
Readme
��#� �V�u�e�x� �C�o�m�p�o�s�i�t�i�o�n� �M�o�d�u�l�e�s�
�
�
�
�[�!�[�B�u�i�l�d� �S�t�a�t�u�s�]�(�h�t�t�p�s�:�/�/�t�r�a�v�i�s�-�c�i�.�o�r�g�/�P�a�t�r�y�k�W�a�l�a�c�h�/�v�u�e�x�-�c�o�m�p�o�s�i�t�i�o�n�-�a�p�i�.�s�v�g�?�b�r�a�n�c�h�=�m�a�s�t�e�r�)�]�(�h�t�t�p�s�:�/�/�t�r�a�v�i�s�-�c�i�.�o�r�g�/�P�a�t�r�y�k�W�a�l�a�c�h�/�v�u�e�x�-�c�o�m�p�o�s�i�t�i�o�n�-�a�p�i�)� �[�!�[�d�o�w�n�l�o�a�d�s�]�(�h�t�t�p�s�:�/�/�i�m�g�.�s�h�i�e�l�d�s�.�i�o�/�n�p�m�/�d�m�/�v�u�e�x�-�c�o�m�p�o�s�i�t�i�o�n�-�a�p�i�)�]�(�h�t�t�p�s�:�/�/�w�w�w�.�n�p�m�j�s�.�c�o�m�/�p�a�c�k�a�g�e�/�v�u�e�x�-�c�o�m�p�o�s�i�t�i�o�n�-�a�p�i�)� �[�!�[�c�o�d�e�c�o�v�]�(�h�t�t�p�s�:�/�/�c�o�d�e�c�o�v�.�i�o�/�g�h�/�P�a�t�r�y�k�W�a�l�a�c�h�/�v�u�e�x�-�c�o�m�p�o�s�i�t�i�o�n�-�a�p�i�/�b�r�a�n�c�h�/�m�a�s�t�e�r�/�g�r�a�p�h�/�b�a�d�g�e�.�s�v�g�)�]�(�h�t�t�p�s�:�/�/�c�o�d�e�c�o�v�.�i�o�/�g�h�/�P�a�t�r�y�k�W�a�l�a�c�h�/�v�u�e�x�-�c�o�m�p�o�s�i�t�i�o�n�-�a�p�i�)� �[�!�[�c�o�d�e� �s�t�y�l�e�:� �p�r�e�t�t�i�e�r�]�(�h�t�t�p�s�:�/�/�i�m�g�.�s�h�i�e�l�d�s�.�i�o�/�b�a�d�g�e�/�c�o�d�e�_�s�t�y�l�e�-�p�r�e�t�t�i�e�r�-�f�f�6�9�b�4�.�s�v�g�?�s�t�y�l�e�=�f�l�a�t�-�s�q�u�a�r�e�)�]�(�h�t�t�p�s�:�/�/�g�i�t�h�u�b�.�c�o�m�/�p�r�e�t�t�i�e�r�/�p�r�e�t�t�i�e�r�)�
�
�
�
�T�h�i�s� �p�r�o�j�e�c�t� �a�l�l�o�w�s� �f�o�r� �e�x�p�e�r�i�m�e�n�t�a�l� �u�s�e� �o�f� �[�V�u�e�x� �5�]�(�h�t�t�p�s�:�/�/�g�i�t�h�u�b�.�c�o�m�/�v�u�e�j�s�/�v�u�e�x�)� �c�o�m�p�o�s�i�t�i�o�n� �A�P�I� �i�n� �[�V�u�e� �3�]�(�h�t�t�p�s�:�/�/�g�i�t�h�u�b�.�c�o�m�/�v�u�e�j�s�/�v�u�e�-�n�e�x�t�)� �.�
�
�
�
�#�#� �T�a�b�l�e� �o�f� �C�o�n�t�e�n�t�s�
�
�
�
�-� �[�G�e�t�t�i�n�g� �s�t�a�r�t�e�d�]�(�#�g�e�t�t�i�n�g�-�s�t�a�r�t�e�d�)�
�
� � �-� �[�C�o�m�p�o�s�i�n�g�]�(�#�c�o�m�p�o�s�i�n�g�)�
�
� � �-� �[�P�l�u�g�i�n�s�]�(�#�p�l�u�g�i�n�s�)�
�
�-� �[�A�P�I�]�(�#�a�p�i�)�
�
�
�
�#�#� �G�e�t�t�i�n�g� �s�t�a�r�t�e�d�
�
�
�
�1�.� � �I�n�s�t�a�l�l� �v�u�e�x�
�
�
�
� � � � ��
��t�s�x�
�
� � � � �i�m�p�o�r�t� �{� �c�r�e�a�t�e�A�p�p� �}� �f�r�o�m� �'�v�u�e�'�
�
� � � � �i�m�p�o�r�t� �{� �c�r�e�a�t�e�V�u�e�x� �}� �f�r�o�m� �'�v�u�e�x�-�c�o�m�p�o�s�i�t�i�o�n�-�a�p�i�'�
�
� � � � �c�o�n�s�t� �v�u�e�x� �=� �c�r�e�a�t�e�V�u�e�x�(�)�
�
�
�
� � � � �c�o�n�s�t� �a�p�p� �=� �c�r�e�a�t�e�A�p�p�(�A�p�p�)�.�u�s�e�(�v�u�e�x�)�
�
� � � � �/�/� �.�.�.�
�
� � � � �
��
�
�
�
�
�2�.� � �D�e�f�i�n�e� �s�t�o�r�e�/�s�t�o�r�e�s�
�
�
�
� � � � ��
��t�s�x�
�
� � � � �i�m�p�o�r�t� �{� �d�e�f�i�n�e�S�t�o�r�e� �}� �f�r�o�m� �'�v�u�e�x�-�c�o�m�p�o�s�i�t�i�o�n�-�a�p�i�'�
�
� � � � �e�x�p�o�r�t� �c�o�n�s�t� �c�o�u�n�t�e�r�S�t�o�r�e� �=� �d�e�f�i�n�e�S�t�o�r�e�(�'�c�o�u�n�t�e�r�'�,� �(�)� �=�>� �{�
�
� � � � � � �c�o�n�s�t� �v�a�l�u�e� �=� �r�e�f�(�0�)�
�
�
�
� � � � � � �f�u�n�c�t�i�o�n� �i�n�c�r�e�m�e�n�t�(�)� �{�
�
� � � � � � � � �v�a�l�u�e�.�v�a�l�u�e�+�+�
�
� � � � � � �}�
�
�
�
� � � � � � �r�e�t�u�r�n� �{� �v�a�l�u�e�,� �i�n�c�r�e�m�e�n�t� �}�
�
� � � � �}�)�
�
� � � � �
��
�
�
�
�
�3�.� � �U�s�e� �s�t�o�r�e�
�
�
�
� � � � ��
��h�t�m�l�
�
� � � � �<�t�e�m�p�l�a�t�e�>�
�
� � � � � � �<�h�1�>�C�o�u�n�t�e�r� �v�a�l�u�e�:� �{�{�c�o�u�n�t�e�r�.�v�a�l�u�e�}�}�<�/�h�1�>�
�
� � � � � � �<�b�u�t�t�o�n� �@�c�l�i�c�k�=�"�c�o�u�n�t�e�r�.�i�n�c�r�e�m�e�n�t�"�>�I�N�C�R�E�M�E�N�T�<�/�b�u�t�t�o�n�>�
�
� � � � �<�/�t�e�m�p�l�a�t�e�>�
�
�
�
� � � � �<�s�c�r�i�p�t� �l�a�n�g�=�"�t�s�"�>�
�
� � � � � � �i�m�p�o�r�t� �{� �d�e�f�i�n�e�c�C�o�m�p�o�n�e�n�t� �}� �f�r�o�m� �'�v�u�e�'�
�
� � � � � � �i�m�p�o�r�t� �{� �u�s�e�S�t�o�r�e� �}� �f�r�o�m� �'�v�u�e�x�-�c�o�m�p�o�s�i�t�i�o�n�-�a�p�i�'�
�
� � � � � � �i�m�p�o�r�t� �{� �c�o�u�n�t�e�r�S�t�o�r�e� �}� �f�r�o�m� �'�.�/�c�o�u�n�t�e�r�'�
�
�
�
� � � � � � �e�x�p�o�r�t� �d�e�f�a�u�l�t� �d�e�f�i�n�e�c�C�o�m�p�o�n�e�n�t�(�{�
�
� � � � � � � � �s�e�t�u�p�(�)� �{�
�
� � � � � � � � � � �c�o�n�s�t� �c�o�u�n�t�e�r� �=� �u�s�e�S�t�o�r�e�(�c�o�u�n�t�e�r�S�t�o�r�e�)�
�
�
�
� � � � � � � � � � �r�e�t�u�r�n� �{�
�
� � � � � � � � � � � � �c�o�u�n�t�e�r�,�
�
� � � � � � � � � � �}�
�
� � � � � � � � �}�,�
�
� � � � � � �}�)�
�
� � � � �<�/�s�c�r�i�p�t�>�
�
� � � � �
��
�
�
�
�
�#�#�#� �C�o�m�p�o�s�i�n�g�
�
�
�
��
��t�s�x�
�
�i�m�p�o�r�t� �{� �d�e�f�i�n�e�S�t�o�r�e� �}� �f�r�o�m� �'�v�u�e�x�-�c�o�m�p�o�s�i�t�i�o�n�-�a�p�i�'�
�
�i�m�p�o�r�t� �{� �a�u�t�h�S�t�o�r�e� �}� �f�r�o�m� �'�.�/�a�u�t�h�'�
�
�
�
�e�x�p�o�r�t� �c�o�n�s�t� �u�s�e�r� �=� �d�e�f�i�n�e�S�t�o�r�e�(�'�u�s�e�r�'�,� �(�{� �u�s�e� �}�)� �=�>� �{�
�
� � �c�o�n�s�t� �a�u�t�h� �=� �u�s�e�(�a�u�t�h�S�t�o�r�e�)�
�
�
�
� � �f�u�n�c�t�i�o�n� �l�o�g�i�n�(�l�o�g�i�n�,� �p�a�s�s�w�o�r�d�)� �{�
�
� � � � �a�u�t�h�.�u�s�e�r�(�l�o�g�i�n�,� �p�a�s�s�w�o�r�d�)�
�
� � �}�
�
�
�
� � �r�e�t�u�r�n� �{� �l�o�g�i�n� �}�
�
�}�)�
�
�
��
�
�
�
�
�#�#�#� �P�l�u�g�i�n�s�
�
�
�
�1�.� �C�r�e�a�t�e� �p�l�u�g�i�n�
�
�
�
� � � ��
��t�s�x�
�
� � � �f�u�n�c�t�i�o�n� �a�x�i�o�s�P�l�u�g�i�n�(�p�r�o�v�i�d�e�)� �{�
�
� � � � � �p�r�o�v�i�d�e�(�'�a�x�i�o�s�'�,� �a�x�i�o�s�)�
�
� � � �}�
�
� � � �
��
�
�
�
�
�2�.� �I�n�s�t�a�l�l� �p�l�u�g�i�n�
�
�
�
� � � ��
��t�s�x�
�
� � � �i�m�p�o�r�t� �{� �c�r�e�a�t�e�A�p�p� �}� �f�r�o�m� �'�v�u�e�'�
�
� � � �i�m�p�o�r�t� �{� �c�r�e�a�t�e�V�u�e�x� �}� �f�r�o�m� �'�v�u�e�x�-�c�o�m�p�o�s�i�t�i�o�n�-�a�p�i�'�
�
�
�
� � � �c�o�n�s�t� �v�u�e�x� �=� �c�r�e�a�t�e�V�u�e�x�(�{� �p�l�u�g�i�n�s�:� �[�a�x�i�o�s�P�l�u�g�i�n�]� �}�)�
�
�
�
� � � �c�o�n�s�t� �a�p�p� �=� �c�r�e�a�t�e�A�p�p�(�A�p�p�)�.�u�s�e�(�v�u�e�x�)�
�
� � � �/�/�.�.�.�
�
� � � �
��
�
�
�
�
�3�.� �U�s�e� �p�l�u�g�i�n�
�
�
�
� � � ��
��t�s�x�
�
� � � �i�m�p�o�r�t� �{� �d�e�f�i�n�e�S�t�o�r�e� �}� �f�r�o�m� �'�v�u�e�x�-�c�o�m�p�o�s�i�t�i�o�n�-�a�p�i�'�
�
�
�
� � � �e�x�p�o�r�t� �c�o�n�s�t� �a�u�t�h�S�t�o�r�e� �=� �d�e�f�i�n�e�S�t�o�r�e�(�'�a�u�t�h�'�,� �(�{� �a�x�i�o�s� �}�)� �=�>� �{�
�
� � � � � �f�u�n�c�t�i�o�n� �u�s�e�r�(�l�o�g�i�n�,� �p�a�s�s�w�o�r�d�)� �{�
�
� � � � � � � �a�x�i�o�s�.�p�o�s�t�(�'�/�l�o�g�i�n�'�,� �{�
�
� � � � � � � � � �l�o�g�i�n�,�
�
� � � � � � � � � �p�a�s�s�w�o�r�d�,�
�
� � � � � � � �}�)�
�
� � � � � �}�
�
�
�
� � � � � �r�e�t�u�r�n� �{� �l�o�g�i�n� �}�
�
� � � �}�)�
�
� � � �
��
�
�
�
�
�#�#�#� �A�P�I�
�
�
�
�#�#� �d�e�f�i�n�e�S�t�o�r�e�
�
�
�
��
��t�s�x�
�
�f�u�n�c�t�i�o�n� �d�e�f�i�n�e�S�t�o�r�e�(�n�a�m�e�:� �s�t�r�i�n�g�,� �s�e�t�u�p�:� �S�t�o�r�e�S�e�t�u�p�)�:� �S�t�o�r�e�
�
�
��
�
�
�
�
�#�#� �c�r�e�a�t�e�V�u�e�x�
�
�
�
��
��t�s�x�
�
�i�n�t�e�r�f�a�c�e� �V�u�e�x� �{�
�
� � �i�n�s�t�a�l�l�(�a�p�p�:� �A�p�p�)�:� �A�p�p�
�
� � �s�t�o�r�e�(�s�t�o�r�e�:� �S�t�o�r�e�)�:� �T�
�
�}�
�
�
�
�f�u�n�c�t�i�o�n� �c�r�e�a�t�e�V�u�e�x�(�o�p�t�i�o�n�s�:� �{� �p�l�u�g�i�n�s�:� �P�l�u�g�i�n�[�]� �}�)�:� �V�u�e�x�
�
�
��
�
�
�
�
�#�#� �u�s�e�S�t�o�r�e�
�
�
�
��
��t�s�x�
�
�f�u�n�c�t�i�o�n� �u�s�e�S�t�o�r�e�(�s�t�o�r�e�O�p�t�i�o�n�s�:� �S�t�o�r�e�)�:� �T�
�
�
��
�
�
�