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/stacks/vue/layers/models.md
+24-12Lines changed: 24 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,7 @@ Binds a value on an object, or the value of a ref, to the query string.
83
83
function useBindToQueryString(ref:Ref<any>, options:BindToQueryStringOptions):void
84
84
85
85
interfaceBindToQueryStringOptions {
86
+
queryKey?:string;
86
87
mode?:'push'|'replace'
87
88
parse?: (value:string) =>any
88
89
stringify?: (value:any) =>string
@@ -99,13 +100,8 @@ Binds a value on an object, or the value of a ref, to the query string.
99
100
100
101
**Auto-detection features:**
101
102
-**ListParameters**: When binding to a `ListParameters` object (or any object with `page` and `pageSize` properties), numeric fields are automatically parsed using `parseInt` without needing to specify a `parse` function.
102
-
-**ListViewModel $ properties**: When binding to properties starting with `$` (e.g., `$page`, `$pageSize`, `$search`), the query key automatically drops the `$` prefix (e.g., `$page` becomes `page` in the URL). Numeric properties are automatically parsed using `parseInt`.
103
-
104
-
::: tip Migration Note
105
-
Existing code using `{ parse: parseInt }` for `ListParameters` properties or manual `queryKey` specification for `$` properties can be simplified by removing these options - the auto-detection will handle them automatically.
106
-
:::
107
-
108
-
If the object being bound to has `$metadata`, information from that metadata will be used to serialize and parse values to and from the query string. Otherwise, the `stringify` option (default: `String(value)`) will be used to serialize the value, and the `parse` option (if provided) will be used to parse the value from the query string.
103
+
-**ListViewModel $ properties**: When binding to the ListViewModel shorthand parameter properties (e.g., `$page`, `$pageSize`, `$search`), the query key automatically drops the `$` prefix (e.g., `$page` becomes `page` in the URL). Numeric properties are automatically parsed using `parseInt`.
104
+
-**Models and DataSources**: When binding to a property on a [Model](#model-interfaces), [ViewModel](./viewmodels.md#viewmodels), or [Data Source](#data-sources), `parse` and `stringify` are auto-configured.
109
105
110
106
-**Example**
111
107
@@ -135,16 +131,32 @@ Binds a value on an object, or the value of a ref, to the query string.
0 commit comments