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/features/macros.md
+12-9Lines changed: 12 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,5 @@
1
1
# Macros
2
2
3
-
<StabilityLevellevel="experimental" />
4
-
5
3
A collection of macros. They are need to muanually enabled by set `macros` to `true`.
6
4
7
5
| Directive | Vue | Volar |
@@ -16,7 +14,7 @@ A collection of macros. They are need to muanually enabled by set `macros` to `t
16
14
17
15
::: code-group
18
16
19
-
```ts {6} [vite.config.ts]
17
+
```ts {7} [vite.config.ts]
20
18
import { defineConfig } from'vite'
21
19
importvueJsxVaporfrom'vue-jsx-vapor/vite'
22
20
@@ -29,7 +27,7 @@ export default defineConfig({
29
27
})
30
28
```
31
29
32
-
```ts {5} [tsm.config.ts]
30
+
```ts {6} [tsm.config.ts]
33
31
importvueJsxVaporfrom'vue-jsx-vapor/volar'
34
32
35
33
exportdefault {
@@ -145,18 +143,19 @@ defineComponent(
145
143
- Will be inferred as a required prop when the expression ends with `!`.
146
144
- The modified model's value can be read synchronously, without needing to `await nextTick()`. [Related issue](https://github.com/vuejs/core/issues/11080)
147
145
148
-
```tsx
146
+
```tsx twoslash
149
147
import { ref } from'vue'
150
148
151
149
function Comp() {
152
150
const modelValue =defineModel<string>()!
153
151
modelValue.value='foo'
154
152
return <div>{modelValue.value}</div>
153
+
// ^?
155
154
}
156
155
157
156
exportdefault () => {
158
157
const foo =ref('')
159
-
return <Compv-model={foo.value} />
158
+
return <inputvalue={foo.value} />
160
159
}
161
160
```
162
161
@@ -208,11 +207,14 @@ function Comp<const T>() {
208
207
)
209
208
}
210
209
210
+
// ---cut-start---
211
+
// prettier-ignore
212
+
// ---cut-end---
211
213
exportdefault () => (
212
214
<Comp<1>>
213
215
<templatev-slot={{ foo }}>{foo}</template>
214
216
<templatev-slot:title={{ bar }}>{bar}</template>
215
-
// ^?
217
+
// ^?
216
218
</Comp>
217
219
)
218
220
```
@@ -221,7 +223,7 @@ export default () => (
221
223
222
224
Just like in Vue SFC.
223
225
224
-
```tsx
226
+
```tsx twoslash
225
227
import { useRef } from'vue-jsx-vapor'
226
228
227
229
const Comp = <T,>({ foo=undefinedasT }) => {
@@ -234,7 +236,7 @@ const Comp = <T,>({ foo = undefined as T }) => {
0 commit comments