vue-computed-with-control 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.github.md +1 -45
- package/README.md +1 -45
- package/README.npm.md +1 -45
- package/package.json +1 -1
package/README.github.md
CHANGED
|
@@ -19,10 +19,8 @@ npm install vue-computed-with-control
|
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
|
-
Explicitly define the dependencies of computed.
|
|
23
|
-
|
|
24
22
|
```ts
|
|
25
|
-
import { computedWithControl } from '
|
|
23
|
+
import { computedWithControl } from '@vueuse/core'
|
|
26
24
|
|
|
27
25
|
const source = ref('foo')
|
|
28
26
|
const counter = ref(0)
|
|
@@ -33,48 +31,6 @@ const computedRef = computedWithControl(
|
|
|
33
31
|
)
|
|
34
32
|
```
|
|
35
33
|
|
|
36
|
-
With this, the changes of `counter` won't trigger `computedRef` to update but the `source` ref does.
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
console.log(computedRef.value) // 0
|
|
40
|
-
|
|
41
|
-
counter.value += 1
|
|
42
|
-
|
|
43
|
-
console.log(computedRef.value) // 0
|
|
44
|
-
|
|
45
|
-
source.value = 'bar'
|
|
46
|
-
|
|
47
|
-
console.log(computedRef.value) // 1
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Manual Triggering
|
|
51
|
-
|
|
52
|
-
You can also manually trigger the update of the computed by:
|
|
53
|
-
|
|
54
|
-
```ts
|
|
55
|
-
const computedRef = computedWithControl(
|
|
56
|
-
() => source.value,
|
|
57
|
-
() => counter.value,
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
computedRef.trigger()
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Deep Watch
|
|
64
|
-
|
|
65
|
-
Unlike `computed`, `computedWithControl` is shallow by default.
|
|
66
|
-
You can specify the same options as `watch` to control the behavior:
|
|
67
|
-
|
|
68
|
-
```ts
|
|
69
|
-
const source = ref({ name: 'foo' })
|
|
70
|
-
|
|
71
|
-
const computedRef = computedWithControl(
|
|
72
|
-
source,
|
|
73
|
-
() => counter.value,
|
|
74
|
-
{ deep: true },
|
|
75
|
-
)
|
|
76
|
-
```
|
|
77
|
-
|
|
78
34
|
## License
|
|
79
35
|
|
|
80
36
|
MIT
|
package/README.md
CHANGED
|
@@ -19,10 +19,8 @@ npm install vue-computed-with-control
|
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
|
-
Explicitly define the dependencies of computed.
|
|
23
|
-
|
|
24
22
|
```ts
|
|
25
|
-
import { computedWithControl } from '
|
|
23
|
+
import { computedWithControl } from '@vueuse/core'
|
|
26
24
|
|
|
27
25
|
const source = ref('foo')
|
|
28
26
|
const counter = ref(0)
|
|
@@ -33,48 +31,6 @@ const computedRef = computedWithControl(
|
|
|
33
31
|
)
|
|
34
32
|
```
|
|
35
33
|
|
|
36
|
-
With this, the changes of `counter` won't trigger `computedRef` to update but the `source` ref does.
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
console.log(computedRef.value) // 0
|
|
40
|
-
|
|
41
|
-
counter.value += 1
|
|
42
|
-
|
|
43
|
-
console.log(computedRef.value) // 0
|
|
44
|
-
|
|
45
|
-
source.value = 'bar'
|
|
46
|
-
|
|
47
|
-
console.log(computedRef.value) // 1
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Manual Triggering
|
|
51
|
-
|
|
52
|
-
You can also manually trigger the update of the computed by:
|
|
53
|
-
|
|
54
|
-
```ts
|
|
55
|
-
const computedRef = computedWithControl(
|
|
56
|
-
() => source.value,
|
|
57
|
-
() => counter.value,
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
computedRef.trigger()
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Deep Watch
|
|
64
|
-
|
|
65
|
-
Unlike `computed`, `computedWithControl` is shallow by default.
|
|
66
|
-
You can specify the same options as `watch` to control the behavior:
|
|
67
|
-
|
|
68
|
-
```ts
|
|
69
|
-
const source = ref({ name: 'foo' })
|
|
70
|
-
|
|
71
|
-
const computedRef = computedWithControl(
|
|
72
|
-
source,
|
|
73
|
-
() => counter.value,
|
|
74
|
-
{ deep: true },
|
|
75
|
-
)
|
|
76
|
-
```
|
|
77
|
-
|
|
78
34
|
## License
|
|
79
35
|
|
|
80
36
|
MIT
|
package/README.npm.md
CHANGED
|
@@ -19,10 +19,8 @@ npm install vue-computed-with-control
|
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
|
-
Explicitly define the dependencies of computed.
|
|
23
|
-
|
|
24
22
|
```ts
|
|
25
|
-
import { computedWithControl } from '
|
|
23
|
+
import { computedWithControl } from '@vueuse/core'
|
|
26
24
|
|
|
27
25
|
const source = ref('foo')
|
|
28
26
|
const counter = ref(0)
|
|
@@ -33,48 +31,6 @@ const computedRef = computedWithControl(
|
|
|
33
31
|
)
|
|
34
32
|
```
|
|
35
33
|
|
|
36
|
-
With this, the changes of `counter` won't trigger `computedRef` to update but the `source` ref does.
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
console.log(computedRef.value) // 0
|
|
40
|
-
|
|
41
|
-
counter.value += 1
|
|
42
|
-
|
|
43
|
-
console.log(computedRef.value) // 0
|
|
44
|
-
|
|
45
|
-
source.value = 'bar'
|
|
46
|
-
|
|
47
|
-
console.log(computedRef.value) // 1
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Manual Triggering
|
|
51
|
-
|
|
52
|
-
You can also manually trigger the update of the computed by:
|
|
53
|
-
|
|
54
|
-
```ts
|
|
55
|
-
const computedRef = computedWithControl(
|
|
56
|
-
() => source.value,
|
|
57
|
-
() => counter.value,
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
computedRef.trigger()
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Deep Watch
|
|
64
|
-
|
|
65
|
-
Unlike `computed`, `computedWithControl` is shallow by default.
|
|
66
|
-
You can specify the same options as `watch` to control the behavior:
|
|
67
|
-
|
|
68
|
-
```ts
|
|
69
|
-
const source = ref({ name: 'foo' })
|
|
70
|
-
|
|
71
|
-
const computedRef = computedWithControl(
|
|
72
|
-
source,
|
|
73
|
-
() => counter.value,
|
|
74
|
-
{ deep: true },
|
|
75
|
-
)
|
|
76
|
-
```
|
|
77
|
-
|
|
78
34
|
## License
|
|
79
35
|
|
|
80
36
|
MIT
|