File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed
packages/babel-plugin-jsx Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -234,10 +234,17 @@ const App = {
234
234
> 注意: 在 `jsx` 中,应该使用 **`v-slots`** 代替 _`v-slot`_
235
235
236
236
```jsx
237
+ const A = (props, { slots }) => (
238
+ <>
239
+ <h1>{ slots.default ? slots.default() : ' foo' }</h1>
240
+ <h2>{ slots.bar?.() }</h2>
241
+ </>
242
+ );
243
+
237
244
const App = {
238
245
setup() {
239
246
const slots = {
240
- foo : () => <span>B</span>,
247
+ bar : () => <span>B</span>,
241
248
};
242
249
return () => (
243
250
<A v-slots={slots}>
@@ -253,7 +260,7 @@ const App = {
253
260
setup() {
254
261
const slots = {
255
262
default: () => <div>A</div>,
256
- foo : () => <span>B</span>,
263
+ bar : () => <span>B</span>,
257
264
};
258
265
return () => <A v-slots={slots} />;
259
266
},
@@ -267,7 +274,7 @@ const App = {
267
274
<A>
268
275
{{
269
276
default: () => <div>A</div>,
270
- foo : () => <span>B</span>,
277
+ bar : () => <span>B</span>,
271
278
}}
272
279
</A>
273
280
<B>{() => "foo"}</B>
Original file line number Diff line number Diff line change @@ -238,10 +238,17 @@ const App = {
238
238
> Note: In `jsx`, _`v-slot`_ should be replace with **`v-slots`**
239
239
240
240
```jsx
241
+ const A = (props, { slots }) => (
242
+ <>
243
+ <h1>{ slots.default ? slots.default() : ' foo' }</h1>
244
+ <h2>{ slots.bar?.() }</h2>
245
+ </>
246
+ );
247
+
241
248
const App = {
242
249
setup() {
243
250
const slots = {
244
- foo : () => <span>B</span>,
251
+ bar : () => <span>B</span>,
245
252
};
246
253
return () => (
247
254
<A v-slots={slots}>
@@ -257,7 +264,7 @@ const App = {
257
264
setup() {
258
265
const slots = {
259
266
default: () => <div>A</div>,
260
- foo : () => <span>B</span>,
267
+ bar : () => <span>B</span>,
261
268
};
262
269
return () => <A v-slots={slots} />;
263
270
},
@@ -271,7 +278,7 @@ const App = {
271
278
<A>
272
279
{{
273
280
default: () => <div>A</div>,
274
- foo : () => <span>B</span>,
281
+ bar : () => <span>B</span>,
275
282
}}
276
283
</A>
277
284
<B>{() => "foo"}</B>
You can’t perform that action at this time.
0 commit comments