question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

slot-scope support multiple parameters

See original GitHub issue

What problem does this feature solve?

slot-scope support multiple parameters in version 2.6.x. It is supported in version 2.5.x. If not supported, our component library(ant-design-vue) has to change some API.

What does the proposed API look like?

like 2.5.x

<template slot="name" slot-scope="text, record, index..."></template>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
yyx990803commented, Feb 11, 2019

I’m a bit torn on this. I will fix this because it worked in the past and I don’t want to force you to re-design your API, but you really should avoid using this in the future, and possibly migrate away from it when you can.

The disadvantage compared to destructuring is:

  1. It’s impossible to pass multiple parameters like this when using templates via <slot foo="bar"/>, and it’s never been explicitly documented with an example - so it will confuse users who don’t know about render functions.

  2. Users have to use the arguments in fixed order and cannot omit the ones they don’t need. e.g. if you have a slot that passes in 5 arguments but the user actually only need the last 2 of them, they will have to declare all 5 just to use the last 2.

  3. If you switch back and forth between the two styles of usage it creates more inconsistency.

1reaction
lirunwincommented, May 14, 2019

v-slot:[col.key]=“text, record”, and I really do not need ‘text’, text is in record object. and my editor is complaining

Read more comments on GitHub >

github_iconTop Results From Across the Web

slot-scope support multiple parameters · Issue #722 - GitHub
If we support multiple arguments, I think that vue-eslint-parser needs the following changes. Change to not throw parse errors. Change AST of ...
Read more >
Slot scope with multi parameters - vue.js - Stack Overflow
When I tried to use two parameters in vue slot scope, I can't find any example about it. When I use the following...
Read more >
Slots - Vue.js
Here, slot-scope declares the received props object as the slotProps variable, and makes it available inside the <template> scope. You can name slotProps ......
Read more >
multiple props in slot-scope or v-slot with vue.js causes ...
However, the correct fix is to allow slot-scope to accept multiple arguments.
Read more >
The Trick to Understanding Scoped Slots in Vue.js - YouTube
Learn more about my "Advanced Vue Component Design" course:http://advancedvue.comIn these screencast, I walk through how scoped slots work ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found