ivue 1.0.2 → 1.0.4
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/.idea/codeStyles/Project.xml +65 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/ivue.iml +8 -0
- package/.idea/modules.xml +8 -0
- package/.idea/php.xml +19 -0
- package/.idea/vcs.xml +6 -0
- package/README.md +23 -7
- package/coverage/clover.xml +159 -159
- package/coverage/coverage-final.json +1 -1
- package/coverage/index.html +17 -17
- package/coverage/index.ts.html +86 -107
- package/dist/index.es.js +74 -90
- package/dist/index.umd.js +1 -1
- package/dist/src/index.d.ts +1 -196
- package/dist/src/ivue.d.ts +218 -0
- package/docs/docs/.vitepress/config.ts +110 -22
- package/docs/docs/.vitepress/dist/404.html +4 -4
- package/docs/docs/.vitepress/dist/api/ivue.html +8 -8
- package/docs/docs/.vitepress/dist/api/propsWithDefaults.html +8 -8
- package/docs/docs/.vitepress/dist/assets/{api_ivue.md.BCZ4q_0D.js → api_ivue.md.MRwb9Lcb.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{api_ivue.md.BCZ4q_0D.lean.js → api_ivue.md.MRwb9Lcb.lean.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{api_propsWithDefaults.md.Cr5FwI9o.lean.js → api_propsWithDefaults.md.CeE4IC-K.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{api_propsWithDefaults.md.Cr5FwI9o.js → api_propsWithDefaults.md.CeE4IC-K.lean.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{app.DRiljpSE.js → app.ConZRsN0.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.CGLWArGd.js +1 -0
- package/docs/docs/.vitepress/dist/assets/chunks/Button.vue_vue_type_script_setup_true_lang.P7niV-n8.js +1 -0
- package/docs/docs/.vitepress/dist/assets/chunks/VPLocalSearchBox.C7VDyivS.js +7 -0
- package/docs/docs/.vitepress/dist/assets/chunks/framework.CNtPHGsN.js +1 -0
- package/docs/docs/.vitepress/dist/assets/chunks/index.es.DnWLDAUc.js +1 -0
- package/docs/docs/.vitepress/dist/assets/chunks/theme.B7n-r1TY.js +2 -0
- package/docs/docs/.vitepress/dist/assets/index.md.wPLoTLBY.js +1 -0
- package/docs/docs/.vitepress/dist/assets/index.md.wPLoTLBY.lean.js +1 -0
- package/docs/docs/.vitepress/dist/assets/pages_advanced-usage.md.BZgX-VP7.js +1 -0
- package/docs/docs/.vitepress/dist/assets/pages_advanced-usage.md.BZgX-VP7.lean.js +1 -0
- package/docs/docs/.vitepress/dist/assets/pages_api.md.C_PvCZns.js +7 -0
- package/docs/docs/.vitepress/dist/assets/pages_api.md.C_PvCZns.lean.js +7 -0
- package/docs/docs/.vitepress/dist/assets/pages_browse-code.md.CPluoaap.js +1 -0
- package/docs/docs/.vitepress/dist/assets/pages_browse-code.md.CPluoaap.lean.js +1 -0
- package/docs/docs/.vitepress/dist/assets/pages_getting-started.md.knQcOZyP.js +8 -0
- package/docs/docs/.vitepress/dist/assets/pages_getting-started.md.knQcOZyP.lean.js +1 -0
- package/docs/docs/.vitepress/dist/assets/pages_guidelines.md.DddPdPom.js +101 -0
- package/docs/docs/.vitepress/dist/assets/pages_guidelines.md.DddPdPom.lean.js +101 -0
- package/docs/docs/.vitepress/dist/assets/pages_how-it-works.md.OJGcGEXF.js +4 -0
- package/docs/docs/.vitepress/dist/assets/pages_how-it-works.md.OJGcGEXF.lean.js +4 -0
- package/docs/docs/.vitepress/dist/assets/pages_how-its-made.md.Vv9Z9TEi.js +1 -0
- package/docs/docs/.vitepress/dist/assets/pages_how-its-made.md.Vv9Z9TEi.lean.js +1 -0
- package/docs/docs/.vitepress/dist/assets/pages_introduction.md.DrDm-R8F.js +1 -0
- package/docs/docs/.vitepress/dist/assets/pages_introduction.md.DrDm-R8F.lean.js +1 -0
- package/docs/docs/.vitepress/dist/assets/pages_usage.md.zSOVjtFF.js +430 -0
- package/docs/docs/.vitepress/dist/assets/pages_usage.md.zSOVjtFF.lean.js +430 -0
- package/docs/docs/.vitepress/dist/assets/style.Fgx7OB_D.css +1 -0
- package/docs/docs/.vitepress/dist/hashmap.json +1 -1
- package/docs/docs/.vitepress/dist/index.html +9 -8
- package/docs/docs/.vitepress/dist/pages/advanced-usage.html +24 -0
- package/docs/docs/.vitepress/dist/pages/api.html +30 -0
- package/docs/docs/.vitepress/dist/pages/browse-code.html +24 -0
- package/docs/docs/.vitepress/dist/pages/getting-started.html +11 -11
- package/docs/docs/.vitepress/dist/pages/guidelines.html +125 -0
- package/docs/docs/.vitepress/dist/pages/how-it-works.html +11 -8
- package/docs/docs/.vitepress/dist/pages/how-its-made.html +24 -0
- package/docs/docs/.vitepress/dist/pages/introduction.html +9 -8
- package/docs/docs/.vitepress/dist/pages/usage.html +428 -14
- package/docs/docs/.vitepress/theme/index.js +5 -0
- package/docs/docs/.vitepress/theme/main.css +29 -0
- package/docs/docs/components/Button.vue +1 -1
- package/docs/docs/components/guidelines/CounterExternalRefsDetailed.vue +41 -0
- package/docs/docs/components/usage/CounterBasic.vue +17 -0
- package/docs/docs/components/usage/CounterComposables.vue +19 -0
- package/docs/docs/components/usage/CounterComposablesDestructuring.vue +46 -0
- package/docs/docs/components/usage/CounterComputeds.vue +25 -0
- package/docs/docs/components/usage/CounterComputedsDisabled.vue +32 -0
- package/docs/docs/components/usage/CounterDefineExpose.vue +12 -0
- package/docs/docs/components/usage/CounterDefineExposeAdvanced.vue +25 -0
- package/docs/docs/components/usage/CounterDefineExposeClass.ts +11 -0
- package/docs/docs/components/usage/CounterExternalRefs.vue +25 -0
- package/docs/docs/components/usage/CounterInsideComposables.vue +27 -0
- package/docs/docs/components/usage/CounterInternalRefs.vue +26 -0
- package/docs/docs/components/usage/CounterLifecycleHooks.vue +22 -0
- package/docs/docs/components/usage/CounterWatch.vue +25 -0
- package/docs/docs/components/usage/CounterWithProps.vue +29 -0
- package/docs/docs/components/usage/CounterWithPropsAndEmits.vue +36 -0
- package/docs/docs/components/usage/functions/useMouse.ts +22 -0
- package/docs/docs/index.md +10 -9
- package/docs/docs/pages/advanced-usage.md +11 -0
- package/docs/docs/pages/api.md +106 -0
- package/docs/docs/pages/browse-code.md +18 -0
- package/docs/docs/pages/getting-started.md +23 -5
- package/docs/docs/pages/guidelines.md +128 -0
- package/docs/docs/pages/how-it-works.md +71 -0
- package/docs/docs/pages/how-its-made.md +32 -0
- package/docs/docs/pages/introduction.md +37 -20
- package/docs/docs/pages/usage.md +347 -10
- package/docs/package.json +4 -3
- package/package.json +4 -2
- package/src/__tests__/ivue.vitest.spec.ts +228 -132
- package/src/index.ts +1 -463
- package/src/ivue.ts +495 -0
- package/vite.config.ts +4 -0
- package/docs/.env +0 -1
- package/docs/docs/.vitepress/dist/assets/chunks/framework.CEhE-9HF.js +0 -1
- package/docs/docs/.vitepress/dist/assets/chunks/theme.CldUEgAJ.js +0 -1
- package/docs/docs/.vitepress/dist/assets/index.md.B1vDz5mb.js +0 -1
- package/docs/docs/.vitepress/dist/assets/index.md.B1vDz5mb.lean.js +0 -1
- package/docs/docs/.vitepress/dist/assets/pages_getting-started.md.C7qtPEWU.js +0 -8
- package/docs/docs/.vitepress/dist/assets/pages_getting-started.md.C7qtPEWU.lean.js +0 -1
- package/docs/docs/.vitepress/dist/assets/pages_how-it-works.md.DKizt6Ny.js +0 -1
- package/docs/docs/.vitepress/dist/assets/pages_how-it-works.md.DKizt6Ny.lean.js +0 -1
- package/docs/docs/.vitepress/dist/assets/pages_introduction.md.Dkqu-XCz.js +0 -1
- package/docs/docs/.vitepress/dist/assets/pages_introduction.md.Dkqu-XCz.lean.js +0 -1
- package/docs/docs/.vitepress/dist/assets/pages_usage.md.qo7ICfLC.js +0 -17
- package/docs/docs/.vitepress/dist/assets/pages_usage.md.qo7ICfLC.lean.js +0 -17
- package/docs/docs/.vitepress/dist/assets/style.BSZVsGuP.css +0 -1
- package/docs/docs/components/examples/Counter.vue +0 -17
package/docs/docs/pages/usage.md
CHANGED
|
@@ -1,16 +1,353 @@
|
|
|
1
|
-
<script lang="ts"
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
import CounterBasic from '../components/usage/CounterBasic.vue'
|
|
5
|
+
import CounterWithProps from '../components/usage/CounterWithProps.vue'
|
|
6
|
+
import CounterWithPropsAndEmits from '../components/usage/CounterWithPropsAndEmits.vue'
|
|
7
|
+
import CounterDefineExpose from '../components/usage/CounterDefineExpose.vue'
|
|
8
|
+
import CounterDefineExposeClass from '../components/usage/CounterDefineExposeClass'
|
|
9
|
+
import CounterExternalRefs from '../components/usage/CounterExternalRefs.vue'
|
|
10
|
+
import CounterInternalRefs from '../components/usage/CounterInternalRefs.vue'
|
|
11
|
+
import CounterComposables from '../components/usage/CounterComposables.vue'
|
|
12
|
+
import CounterComposablesDestructuring from '../components/usage/CounterComposablesDestructuring.vue'
|
|
13
|
+
import CounterInsideComposables from '../components/usage/CounterInsideComposables.vue'
|
|
14
|
+
import CounterComputeds from '../components/usage/CounterComputeds.vue'
|
|
15
|
+
import CounterComputedsDisabled from '../components/usage/CounterComputedsDisabled.vue'
|
|
16
|
+
import CounterWatch from '../components/usage/CounterWatch.vue'
|
|
17
|
+
import CounterLifecycleHooks from '../components/usage/CounterLifecycleHooks.vue'
|
|
18
|
+
|
|
19
|
+
// <For CounterWithPropsAndEmits example start>
|
|
20
|
+
function onIncrement(value: number) {
|
|
21
|
+
alert('Count is now: ' + value);
|
|
22
|
+
}
|
|
23
|
+
// </For CounterWithPropsAndEmits example end>
|
|
24
|
+
|
|
25
|
+
// <For CounterDefineExpose example start>
|
|
26
|
+
const defineExposeRef = ref<CounterDefineExposeClass | null>(null);
|
|
27
|
+
|
|
28
|
+
function increment() {
|
|
29
|
+
defineExposeRef.value.increment();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function decrement() {
|
|
33
|
+
defineExposeRef.value.decrement();
|
|
34
|
+
}
|
|
35
|
+
// </For CounterDefineExpose example end>
|
|
4
36
|
|
|
5
37
|
</script>
|
|
6
38
|
|
|
7
|
-
#
|
|
39
|
+
# Example Usage
|
|
40
|
+
|
|
41
|
+
Using ivue is very simple, but you need to understand a few principles. See the examples below expanding on each principle.
|
|
42
|
+
|
|
43
|
+
## Basic Usage
|
|
44
|
+
|
|
45
|
+
Classic Counter example built with `ivue`
|
|
46
|
+
::: code-group
|
|
47
|
+
<<< @/components/usage/CounterBasic.vue{15 vue:line-numbers}
|
|
48
|
+
:::
|
|
49
|
+
|
|
50
|
+
:::details For this example we initialize the component like this:
|
|
51
|
+
|
|
52
|
+
```vue
|
|
53
|
+
<template>
|
|
54
|
+
<CounterBasic />
|
|
55
|
+
</template>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
:::
|
|
59
|
+
|
|
60
|
+
<div style="font-size: 18px; font-weight: 500;">Result</div>
|
|
61
|
+
|
|
62
|
+
<CounterBasic />
|
|
63
|
+
::: warning NOTICE: JavaScript Class Caveat
|
|
64
|
+
See `() => counter.increment()`. You cannot simply use `counter.increment` to refer to the method when it was defined as an object of a class, because that method would not know that it has to be bound to `counter`. You have to either use `() => counter.increment()` or `counter.increment.bind(counter)`, but the latter example is too verbose, so the preferred more readable way is to use an arrow function.
|
|
65
|
+
:::
|
|
66
|
+
|
|
67
|
+
## Using Props
|
|
8
68
|
|
|
9
|
-
|
|
69
|
+
See the highlighted sections related to props.
|
|
70
|
+
::: code-group
|
|
71
|
+
<<< @/components/usage/CounterWithProps.vue{5-8,11-12,24 vue:line-numbers}
|
|
72
|
+
:::
|
|
10
73
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
74
|
+
:::details For this example we initialize the component like this:
|
|
75
|
+
|
|
76
|
+
```vue
|
|
77
|
+
<template>
|
|
78
|
+
<CounterWithProps :initial-count="5" />
|
|
79
|
+
</template>
|
|
14
80
|
```
|
|
15
|
-
|
|
16
|
-
|
|
81
|
+
|
|
82
|
+
:::
|
|
83
|
+
|
|
84
|
+
<div style="font-size: 18px; font-weight: 500;">Result</div>
|
|
85
|
+
|
|
86
|
+
<CounterWithProps :initial-count="5" />
|
|
87
|
+
|
|
88
|
+
## Using Emits
|
|
89
|
+
|
|
90
|
+
See the highlighted sections related to using emits.
|
|
91
|
+
|
|
92
|
+
::: code-group
|
|
93
|
+
<<< @/components/usage/CounterWithPropsAndEmits.vue{9-11,14,17,23,31 vue:line-numbers}
|
|
94
|
+
:::
|
|
95
|
+
|
|
96
|
+
:::details For this example we initialize the component like this:
|
|
97
|
+
|
|
98
|
+
```vue
|
|
99
|
+
<script setup lang="ts">
|
|
100
|
+
function onIncrement(value: number) {
|
|
101
|
+
alert('Count is now: ' + value);
|
|
102
|
+
}
|
|
103
|
+
</script>
|
|
104
|
+
<template>
|
|
105
|
+
<CounterWithPropsAndEmits :initial-count="5" @increment="onIncrement" />
|
|
106
|
+
</template>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
:::
|
|
110
|
+
|
|
111
|
+
<div style="font-size: 18px; font-weight: 500;">Result</div>
|
|
112
|
+
|
|
113
|
+
<CounterWithPropsAndEmits :initial-count="5" @increment="onIncrement" />
|
|
114
|
+
|
|
115
|
+
## Using Refs
|
|
116
|
+
|
|
117
|
+
### Refs defined externally in the component outside of the class.
|
|
118
|
+
|
|
119
|
+
::: code-group
|
|
120
|
+
<<< @/components/usage/CounterExternalRefs.vue{5,8,12,16,24 vue:line-numbers}
|
|
121
|
+
:::
|
|
122
|
+
:::details For this example we initialize the component like this:
|
|
123
|
+
|
|
124
|
+
```vue
|
|
125
|
+
<template>
|
|
126
|
+
<CounterExternalRefs />
|
|
127
|
+
</template>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
:::
|
|
131
|
+
|
|
132
|
+
<div style="font-size: 18px; font-weight: 500;">Result</div>
|
|
133
|
+
|
|
134
|
+
<CounterExternalRefs />
|
|
135
|
+
|
|
136
|
+
### Refs defined internally inside of the class.
|
|
137
|
+
|
|
138
|
+
::: code-group
|
|
139
|
+
<<< @/components/usage/CounterInternalRefs.vue{7,15,25 vue:line-numbers}
|
|
140
|
+
:::
|
|
141
|
+
|
|
142
|
+
:::details For this example we initialize the component like this:
|
|
143
|
+
|
|
144
|
+
```vue
|
|
145
|
+
<template>
|
|
146
|
+
<CounterInternalRefs />
|
|
147
|
+
</template>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
:::
|
|
151
|
+
|
|
152
|
+
<div style="font-size: 18px; font-weight: 500;">Result</div>
|
|
153
|
+
|
|
154
|
+
<CounterInternalRefs />
|
|
155
|
+
|
|
156
|
+
## Using Define Expose
|
|
157
|
+
|
|
158
|
+
### Use class as interface for `defineExpose()`
|
|
159
|
+
See the highlighted sections related to `defineExpose`.
|
|
160
|
+
|
|
161
|
+
::: code-group
|
|
162
|
+
<<< @/components/usage/CounterDefineExpose.vue{8 vue:line-numbers}
|
|
163
|
+
<<< @/components/usage/CounterDefineExposeClass.ts{ts:line-numbers}
|
|
164
|
+
:::
|
|
165
|
+
|
|
166
|
+
:::details For this example we initialize the component like this:
|
|
167
|
+
|
|
168
|
+
```vue
|
|
169
|
+
<script setup lang="ts">
|
|
170
|
+
const defineExposeRef = ref<CounterDefineExposeClass | null>(null);
|
|
171
|
+
|
|
172
|
+
function increment() {
|
|
173
|
+
defineExposeRef.value.increment();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function decrement() {
|
|
177
|
+
defineExposeRef.value.decrement();
|
|
178
|
+
}
|
|
179
|
+
</script>
|
|
180
|
+
<template>
|
|
181
|
+
<button @click="increment">
|
|
182
|
+
Increment via Component Ref from Parent Component</button
|
|
183
|
+
><br />
|
|
184
|
+
<button @click="decrement">
|
|
185
|
+
Decrement via Component Ref from Parent Component
|
|
186
|
+
</button>
|
|
187
|
+
<CounterDefineExpose />
|
|
188
|
+
</template>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
:::
|
|
192
|
+
|
|
193
|
+
<div style="font-size: 18px; font-weight: 500;">Result</div>
|
|
194
|
+
|
|
195
|
+
<button class="button" @click="increment">Increment via Component Ref from Parent Component</button><br />
|
|
196
|
+
<button class="button" @click="decrement">Decrement via Component Ref from Parent Component</button>
|
|
197
|
+
<CounterDefineExpose ref="defineExposeRef" />
|
|
198
|
+
|
|
199
|
+
### Pick allowed interface properties for `defineExpose()`
|
|
200
|
+
|
|
201
|
+
::: code-group
|
|
202
|
+
<<< @/components/usage/CounterDefineExposeAdvanced.vue{9,23 vue:line-numbers}
|
|
203
|
+
:::
|
|
204
|
+
|
|
205
|
+
## Using Composables
|
|
206
|
+
|
|
207
|
+
### Assign a composable to a class property
|
|
208
|
+
|
|
209
|
+
See the highlighted sections related to composable usage.
|
|
210
|
+
::: code-group
|
|
211
|
+
<<< @/components/usage/CounterComposables.vue{4,11,19 vue:line-numbers}
|
|
212
|
+
:::
|
|
213
|
+
|
|
214
|
+
:::details For this example we initialize the component like this:
|
|
215
|
+
|
|
216
|
+
```vue
|
|
217
|
+
<template>
|
|
218
|
+
<CounterComposables />
|
|
219
|
+
</template>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
:::
|
|
223
|
+
|
|
224
|
+
<div style="font-size: 18px; font-weight: 500;">Result</div>
|
|
225
|
+
|
|
226
|
+
<CounterComposables />
|
|
227
|
+
|
|
228
|
+
### Destructuring composable into the class
|
|
229
|
+
|
|
230
|
+
See the highlighted sections related to destructuring composable usage.
|
|
231
|
+
|
|
232
|
+
::: code-group
|
|
233
|
+
<<< @/components/usage/CounterComposablesDestructuring.vue{4,10,20-21,23-24,27-32 vue:line-numbers}
|
|
234
|
+
<<< @/components/usage/functions/useMouse.ts{ts:line-numbers} [functions/useMouse.ts]
|
|
235
|
+
:::
|
|
236
|
+
|
|
237
|
+
:::details For this example we initialize the component like this:
|
|
238
|
+
|
|
239
|
+
```vue
|
|
240
|
+
<template>
|
|
241
|
+
<CounterComposablesDestructuring />
|
|
242
|
+
</template>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
:::
|
|
246
|
+
|
|
247
|
+
<div style="font-size: 18px; font-weight: 500;">Result</div>
|
|
248
|
+
|
|
249
|
+
<CounterComposablesDestructuring />
|
|
250
|
+
|
|
251
|
+
## Using Inside Composables
|
|
252
|
+
|
|
253
|
+
See the highlighted sections related to using `ivue` inside a composable.
|
|
254
|
+
|
|
255
|
+
::: code-group
|
|
256
|
+
<<< @/components/usage/CounterInsideComposables.vue{14 vue:line-numbers}
|
|
257
|
+
:::
|
|
258
|
+
|
|
259
|
+
:::details For this example we initialize the component like this:
|
|
260
|
+
|
|
261
|
+
```vue
|
|
262
|
+
<template>
|
|
263
|
+
<CounterInsideComposables />
|
|
264
|
+
</template>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
:::
|
|
268
|
+
|
|
269
|
+
<div style="font-size: 18px; font-weight: 500;">Result</div>
|
|
270
|
+
|
|
271
|
+
<CounterInsideComposables />
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
## Using Computeds
|
|
275
|
+
|
|
276
|
+
### Getters are computeds in `ivue` unless disabled.<br />
|
|
277
|
+
See the highlighted sections related to getters.
|
|
278
|
+
|
|
279
|
+
::: code-group
|
|
280
|
+
<<< @/components/usage/CounterComputeds.vue{10,13,23,24 vue:line-numbers}
|
|
281
|
+
:::
|
|
282
|
+
|
|
283
|
+
:::details For this example we initialize the component like this:
|
|
284
|
+
```vue
|
|
285
|
+
<template>
|
|
286
|
+
<CounterComputeds />
|
|
287
|
+
</template>
|
|
288
|
+
```
|
|
289
|
+
:::
|
|
290
|
+
|
|
291
|
+
<div style="font-size: 18px; font-weight: 500;">Result</div>
|
|
292
|
+
<CounterComputeds />
|
|
293
|
+
|
|
294
|
+
### Disable computed behavior for certain getters in `ivue`.<br />
|
|
295
|
+
You can disable computed getters via `static ivue = { getter: false }`, see below:
|
|
296
|
+
|
|
297
|
+
::: code-group
|
|
298
|
+
<<< @/components/usage/CounterComputedsDisabled.vue{10-12 vue:line-numbers}
|
|
299
|
+
:::
|
|
300
|
+
|
|
301
|
+
The result of this example is identical to the above.
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
## Using Watch
|
|
306
|
+
|
|
307
|
+
To use `watch`, `watchEffect`, and other reactive functions, declare `.init()` method in the class.
|
|
308
|
+
See the highlighted sections related to using `init()` below:
|
|
309
|
+
|
|
310
|
+
::: code-group
|
|
311
|
+
<<< @/components/usage/CounterWatch.vue{6-13 vue:line-numbers}
|
|
312
|
+
:::
|
|
313
|
+
|
|
314
|
+
:::details For this example we initialize the component like this:
|
|
315
|
+
|
|
316
|
+
```vue
|
|
317
|
+
<template>
|
|
318
|
+
<CounterWatch />
|
|
319
|
+
</template>
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
:::
|
|
323
|
+
|
|
324
|
+
<div style="font-size: 18px; font-weight: 500;">Result</div>
|
|
325
|
+
|
|
326
|
+
<CounterWatch />
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
## Using Lifecycle Hooks
|
|
331
|
+
|
|
332
|
+
To use `onMounted`, `onBeforeMount` and other lifecycle, declare `.init()` method in the class.
|
|
333
|
+
See the highlighted sections related to using `init()` below:
|
|
334
|
+
|
|
335
|
+
::: tip NOTICE:
|
|
336
|
+
`init()` method can be declared as `async` if needed.
|
|
337
|
+
:::
|
|
338
|
+
|
|
339
|
+
::: code-group
|
|
340
|
+
<<< @/components/usage/CounterLifecycleHooks.vue{7-9 vue:line-numbers}
|
|
341
|
+
:::
|
|
342
|
+
|
|
343
|
+
:::details For this example we initialize the component like this:
|
|
344
|
+
|
|
345
|
+
```vue
|
|
346
|
+
<template>
|
|
347
|
+
<CounterLifecycleHooks />
|
|
348
|
+
</template>
|
|
349
|
+
```
|
|
350
|
+
:::
|
|
351
|
+
|
|
352
|
+
<div style="font-size: 18px; font-weight: 500;">Result</div>
|
|
353
|
+
<CounterLifecycleHooks />
|
package/docs/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"build": "vitepress build docs",
|
|
8
8
|
"serve": "vitepress serve docs",
|
|
9
9
|
"preview": "vitepress build docs && vitepress serve docs",
|
|
10
|
-
"deploy": "node scripts/gh-pages-deploy.js"
|
|
10
|
+
"deploy": "node scripts/gh-pages-deploy.js",
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
|
@@ -18,13 +18,14 @@
|
|
|
18
18
|
"eslint-plugin-import": "^2.29.1",
|
|
19
19
|
"eslint-plugin-vue": "^9.14.1",
|
|
20
20
|
"execa": "^8.0.0",
|
|
21
|
-
"ivue": "^1.0.
|
|
21
|
+
"ivue": "^1.0.3",
|
|
22
22
|
"typescript": "^4.5.4",
|
|
23
23
|
"vite-plugin-dynamic-import": "^1.5.0",
|
|
24
24
|
"vite-tsconfig-paths": "^4.3.2",
|
|
25
25
|
"vitepress": "^1.0.0",
|
|
26
26
|
"vue": "3.2.44",
|
|
27
|
-
"vue-dd": "1.6.7"
|
|
27
|
+
"vue-dd": "1.6.7",
|
|
28
|
+
"vue-use": "^0.2.0"
|
|
28
29
|
},
|
|
29
30
|
"pnpm": {
|
|
30
31
|
"peerDependencyRules": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ivue",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Infinite Vue – Class Based Architecture for Vue 3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"coverage": "vitest run --coverage",
|
|
20
20
|
"cypress": "cypress run --component",
|
|
21
21
|
"cypress:headed": "cypress run --component --browser chrome --headed --no-exit",
|
|
22
|
-
"build": "vite build"
|
|
22
|
+
"build": "vite build",
|
|
23
|
+
"release": "yarn build && yarn publish"
|
|
23
24
|
},
|
|
24
25
|
"peerDependencies": {
|
|
25
26
|
"vue": "^3.0.0"
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
"eslint-plugin-storybook": "^0.6.12",
|
|
44
45
|
"eslint-plugin-vue": "^9.14.1",
|
|
45
46
|
"jsdom": "^21.0.0",
|
|
47
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
46
48
|
"typescript": "^4.5.4",
|
|
47
49
|
"vite": "^4.0.4",
|
|
48
50
|
"vite-plugin-dts": "^1.7.1",
|