You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/model-classes.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -339,7 +339,9 @@ const todo = new Todo({ description: 'Do something!' })
339
339
340
340
The examples above show instantiating a new Model instance without an `id` field. In this case, the record is not added to the Vuex store. If you instantiate a record **with an `id`** field, it **will** get added to the Vuex store. *Note: This field is customizable using the `idField` option for this service.*
341
341
342
-
Now that we have Model instances, let's take a look at the functionality they provide. Each instance will include the following methods:
342
+
Now that we have Model instances, let's take a look at the functionality they provide.
343
+
344
+
Each instance will include the following methods:
343
345
344
346
-`.save()`
345
347
-`.create()`
@@ -349,6 +351,15 @@ Now that we have Model instances, let's take a look at the functionality they pr
349
351
-`.commit()`
350
352
-`.reset()`
351
353
354
+
and the following readonly attributes:
355
+
356
+
-`isCreatePending` - `create` is currently pending on this model
357
+
-`isUpdatePending` - `update` is currently pending on this model
358
+
-`isPatchPending` - `patch` is currently pending on this model
359
+
-`isRemovePending` - `remove` is currently pending on this model
360
+
-`isSavePending` - Any of `create`, `update` or `patch` is currently pending on this model
361
+
-`isPending` - Any method is currently pending on this model
362
+
352
363
*Remember, if a record already has an attribute with any of these method names, it will be overwritten with the method.*
353
364
354
365
These methods give access to many of the store `actions` and `mutations`. Using Model instances, you no longer have to use `mapActions` for `create`, `patch`, `update`, or `remove`. You also no longer have to use `mapMutations` for `createCopy`, `commitCopy`, or `resetCopy`.
0 commit comments