Component slots
ubugeeei opened this issue ยท 7 comments
I am trying to implement this issue, I noticed that currently slot outlets need to be obtained through the instance, do we need to create a createSlot function to handle this?
function render(_ctx) {
// some codess
const n3 = _createSlot('default', {
foo: ()=> _ctx.bar
}, () => {
return _template('<div>fallback content</div>')
})
// some codes
}I see. Is this similar to the discussion here?
#84
#74 (comment)
Is it not good to directly reference currentInstance or use getCurrentInstance?
Considering props and attrs as well, it might be better to have a function that directly references the instance or a function for accessing parts of it, rather than creating createSlot. ๐ค
getCurrentInstance, or getSlots, getAttrs, getProps, .... ๐ค ๐ค
What do you think? cc @sxzz
I think it is necessary, because for complex requirements such as dynamic slot outlets (<slot :name="foo" />), encapsulating functions can reduce the complexity of generating code.
Indeed. That might be better.
I think createSlots is a proper abstraction considering scope slot is a pretty complex feature.
We have available slot features. Next, I will focus more on the related lifecycle hooks.