rettend / pinia-generic Goto Github PK
View Code? Open in Web Editor NEWSplit stores and create Generic stores in Pinia
Home Page: https://rettend.github.io/pinia-generic/
License: MIT License
Split stores and create Generic stores in Pinia
Home Page: https://rettend.github.io/pinia-generic/
License: MIT License
So I have successfully used pinia-generic in my project to extend a base store. An example would be for the generic:
https://github.com/stamp-web/stamp-web-vuejs/blob/main/src/stores/baseModelStore.ts
and then the implementaton:
https://github.com/stamp-web/stamp-web-vuejs/blob/main/src/stores/albumStore.ts
This works Perfectly! and compared to my first attempt of a single store having entity type named methods is a thing of beauty. But I have been having trouble figuring out how to declare a level in between. ie. a Generic Store to extend a Generic Store. Ideally I'd want something like
baseModelStore<T extends PersistedModel> { }
baseManagedStore<T extends PersistedNamedModel>{ // extends the baseModelStore but has some new implementation }
albumStore extends baseManagedStore<Album>
For the baseManagedStore
I created my type that extended the BaseModelStoreType
but then it was unclear whether for the store I have to make this "useStore" or use the "defineGenericStore". The later seems like what I'd want here - to define a generic, add some implementation but extend the baseModelStore
- just not sure how to make it "extend" the baseModelStore
I guess.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.