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 = {
234234> 注意: 在 `jsx` 中,应该使用 **`v-slots`** 代替 _`v-slot`_
235235
236236```jsx
237+ const A = (props, { slots }) => (
238+ <>
239+ <h1>{ slots.default ? slots.default() : ' foo' }</h1>
240+ <h2>{ slots.bar?.() }</h2>
241+ </>
242+ );
243+
237244const App = {
238245 setup() {
239246 const slots = {
240- foo : () => <span>B</span>,
247+ bar : () => <span>B</span>,
241248 };
242249 return () => (
243250 <A v-slots={slots}>
@@ -253,7 +260,7 @@ const App = {
253260 setup() {
254261 const slots = {
255262 default: () => <div>A</div>,
256- foo : () => <span>B</span>,
263+ bar : () => <span>B</span>,
257264 };
258265 return () => <A v-slots={slots} />;
259266 },
@@ -267,7 +274,7 @@ const App = {
267274 <A>
268275 {{
269276 default: () => <div>A</div>,
270- foo : () => <span>B</span>,
277+ bar : () => <span>B</span>,
271278 }}
272279 </A>
273280 <B>{() => "foo"}</B>
Original file line number Diff line number Diff line change @@ -238,10 +238,17 @@ const App = {
238238> Note: In `jsx`, _`v-slot`_ should be replace with **`v-slots`**
239239
240240```jsx
241+ const A = (props, { slots }) => (
242+ <>
243+ <h1>{ slots.default ? slots.default() : ' foo' }</h1>
244+ <h2>{ slots.bar?.() }</h2>
245+ </>
246+ );
247+
241248const App = {
242249 setup() {
243250 const slots = {
244- foo : () => <span>B</span>,
251+ bar : () => <span>B</span>,
245252 };
246253 return () => (
247254 <A v-slots={slots}>
@@ -257,7 +264,7 @@ const App = {
257264 setup() {
258265 const slots = {
259266 default: () => <div>A</div>,
260- foo : () => <span>B</span>,
267+ bar : () => <span>B</span>,
261268 };
262269 return () => <A v-slots={slots} />;
263270 },
@@ -271,7 +278,7 @@ const App = {
271278 <A>
272279 {{
273280 default: () => <div>A</div>,
274- foo : () => <span>B</span>,
281+ bar : () => <span>B</span>,
275282 }}
276283 </A>
277284 <B>{() => "foo"}</B>
You can’t perform that action at this time.
0 commit comments