-
Notifications
You must be signed in to change notification settings - Fork 131
Closed
Description
Here is my code:
export const _isComponent = (tab) => tab.hasOwnProperty('component')
export const _askedForPassedProps = (tab) => tab.hasOwnProperty('props')
const TabContentWrapper = {
functional: true,
name: "TabContentWrapper",
props: {
// tabs: {
// type: Array,
// required: true
// },
//
// activeTab: {
// type: Number,
// required: true
// },
},
render (h, context) {
const props = context.data.attrs,
tabs = props.tabs,
activeTab = props["active-tab"],
contents = tabs.map( (_tab, index) => {
const isComponent = _isComponent(_tab),
isShown = index === activeTab
let askedProps = _askedForPassedProps(_tab) && _tab.props,
finalProps = {}
if (askedProps) {
_.each(askedProps, (prop) => finalProps[prop] = props[prop])
}
const data = { 'props': finalProps }
debugger
return isComponent ?
<_tab.component v-show={isShown} {...data}></_tab.component> :
<router-view v-show={isShown} name={_tab.name} {...finalProps}></router-view>
})
return (
<div class="tab-content">
{contents}
</div>
)
}
}
export default TabContentWrapper
None of the techniques used to inject props works 😢
papiro and Flashantik
Metadata
Metadata
Assignees
Labels
No labels