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
-[Watch Route Query and Params Changes](#watch-route-query-and-params-changes)
15
+
16
+
## Installation
10
17
11
18
```sh
12
19
# Using npm
@@ -16,18 +23,15 @@ npm install @gradin/vue-utils
16
23
yarn add @gradin/vue-utils
17
24
```
18
25
19
-
## Featurs
26
+
## Features
20
27
21
28
### Improved Vue Reactive
22
29
23
30
The `gReactive` function is a wrapper around Vue's `reactive` function that adds some useful features.
24
31
-**Reset**: The `reset` method resets the reactive object to its initial state.
25
32
-**Set**: The `set` method sets the reactive object to a new value, merging the new value with the existing value.
26
33
27
-
Example `reactive` vs `gReactive`
28
-
29
-
<details>
30
-
<summary>Show Codes</summary>
34
+
Example `reactive` vs `gReactive`:
31
35
32
36
```typescript
33
37
// before
@@ -82,4 +86,54 @@ Example `reactive` vs `gReactive`
82
86
})
83
87
}
84
88
```
85
-
</details>
89
+
90
+
### Watch Route Query and Params Changes
91
+
92
+
The `whenRouteChange` will allow you to do something changes but still on the same page. It is also triggered on the first mount of the component.
93
+
94
+
`whenRouteChange` accepts two arguments:
95
+
-`callback`: The function to be called when the route query or params changes.
96
+
-`watchSource`: Optional. A function that returns the value to be watched. If not provided, it will watch the entire route query and route params object.
0 commit comments