Skip to content

Commit 05b4744

Browse files
hastommarcosmoura
authored andcommitted
fix(MdApp): normalized component's tag before checking to match slot … (#1994)
1 parent 3f3cfa8 commit 05b4744

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/components/MdApp/MdApp.vue

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010
'md-app-content'
1111
]
1212
13+
function normilizeTagName (tagName) {
14+
return tagName.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
15+
}
16+
1317
function isValidChild (componentOptions) {
14-
return componentOptions && componentTypes.includes(componentOptions.tag)
18+
return componentOptions && componentTypes.includes(normilizeTagName(componentOptions.tag))
1519
}
1620
1721
function isRightDrawer (propsData) {
@@ -42,7 +46,7 @@
4246
const componentOptions = child.componentOptions
4347
4448
if (shouldRenderSlot(data, componentOptions)) {
45-
const slotName = data.slot || componentOptions.tag
49+
const slotName = data.slot || normilizeTagName(componentOptions.tag)
4650
child.data.slot = slotName
4751
4852
if (slotName === 'md-app-drawer') {
@@ -79,7 +83,7 @@
7983
8084
function getDrawers (children) {
8185
const drawerVnodes = children.filter(child => {
82-
const tag = child.data.slot || child.componentOptions.tag
86+
const tag = child.data.slot || normilizeTagName(child.componentOptions.tag)
8387
return tag === 'md-app-drawer'
8488
})
8589
return drawerVnodes.length ? drawerVnodes : []

0 commit comments

Comments
 (0)