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 logic in pinia-orm then you need to use following option.
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.
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
}