Skip to content

Commit

Permalink
fix(MdApp): normalized component's tag before checking to match slot … (
Browse files Browse the repository at this point in the history
  • Loading branch information
hastom authored and marcosmoura committed May 11, 2019
1 parent 3f3cfa8 commit 05b4744
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/MdApp/MdApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@
'md-app-content'
]
function normilizeTagName (tagName) {
return tagName.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
}
function isValidChild (componentOptions) {
return componentOptions && componentTypes.includes(componentOptions.tag)
return componentOptions && componentTypes.includes(normilizeTagName(componentOptions.tag))
}
function isRightDrawer (propsData) {
Expand Down Expand Up @@ -42,7 +46,7 @@
const componentOptions = child.componentOptions
if (shouldRenderSlot(data, componentOptions)) {
const slotName = data.slot || componentOptions.tag
const slotName = data.slot || normilizeTagName(componentOptions.tag)
child.data.slot = slotName
if (slotName === 'md-app-drawer') {
Expand Down Expand Up @@ -79,7 +83,7 @@
function getDrawers (children) {
const drawerVnodes = children.filter(child => {
const tag = child.data.slot || child.componentOptions.tag
const tag = child.data.slot || normilizeTagName(child.componentOptions.tag)
return tag === 'md-app-drawer'
})
return drawerVnodes.length ? drawerVnodes : []
Expand Down

0 comments on commit 05b4744

Please sign in to comment.