-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add scoped slots option #507
Changes from 1 commit
cecf8eb
e7da1f7
37c5950
3c841a1
ea2d16f
8f3239f
d4e7bdf
e6ad08d
8da1a4e
7665971
0953171
f737344
d925dcf
58399c5
4678bfb
032513c
a1f008c
cb000ea
4690a6a
73a7e5f
125c39c
303d1a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,10 +75,9 @@ export default function createInstance ( | |
if (scopedSlotFn) { | ||
props = { ...bindObject, ...props } | ||
const proxy = {} | ||
Object.keys(vm._renderProxy).concat(Object.keys(Vue.prototype)).forEach((key) => { | ||
if (key[0] === '_') { | ||
proxy[key] = vm._renderProxy[key] | ||
} | ||
const helpers = ['_c', '_o', '_n', '_s', '_l', '_t', '_q', '_i', '_m', '_f', '_k', '_b', '_v', '_e', '_u', '_g'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
helpers.forEach((key) => { | ||
proxy[key] = vm._renderProxy[key] | ||
}) | ||
proxy[slotScope] = props | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since when
scopedSlotFn
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does Vue throw an error if there are two conflicting slot scopes? If not, we should throw an error here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is impossible to set a word that starts with "_" in Vue.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant if you mounted with this option:
The second scopedSlot would overwrite the first scopedSlots in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not possible to register the same key.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤦♂️ Of course ;p |
||
return scopedSlotFn.call(proxy) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to set vm._renderProxy.props?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scopedSlotFn
needsvm._renderProxy.props
.If
vm._renderProxy.prop
is not setted, the render function can not useprops
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a bug.
When
slot-scope
is other thanprops
, this is not work.