-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pinia-orm): Pinia setup store syntax support (#1905)
* feat(pinia-orm): Pinia setup store syntax support * refactor(pinia-orm): fix lock file * docs(pinia-orm): Add configuration to documentation * refactor(pinia-orm): Update eslint caches Resolves: #1888
- Loading branch information
Showing
15 changed files
with
117 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Configuration | ||
|
||
## On initialization | ||
|
||
In pinia-orm you can define different configurations for pinia-orm `createORM`. | ||
|
||
### Using setup stores in pinia-orm | ||
|
||
If you want to use [setup store](https://pinia.vuejs.org/core-concepts/#Setup-Stores) logic in pinia-orm then you need | ||
to use following option. | ||
|
||
````ts | ||
createPiniaORM({ pinia: { storeType: 'setupStore' } }) | ||
```` | ||
|
||
Now you can use the syntax in your models by using the regular `piniaOptions` property. And to pass pinia config options | ||
you now need to use `piniaExtend` for example if you want to pass some configuration to an other pinia plugin. | ||
|
||
````ts | ||
class User extends Model { | ||
static entity = 'users' | ||
|
||
static piniaOptions = { | ||
newData: ref('1'), | ||
} | ||
|
||
static piniaExtend = { | ||
persist: true, | ||
} | ||
|
||
@Attr(0) declare id: number | ||
@Str('') declare name: string | ||
@Str('') declare username: string | ||
} | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters