Skip to content

Commit 9073313

Browse files
VdustRmarcosmoura
authored andcommitted
feat(MdApp): custom class and style (#1256)
1254
1 parent 72bba16 commit 9073313

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/components/MdApp/MdApp.vue

+12-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
export default {
4747
name: 'MdApp',
4848
functional: true,
49-
render (createElement, { children, props }) {
49+
render (createElement, { children, props, data }) {
5050
let appComponent = MdAppSideDrawer
5151
const { context, functionalContext, componentOptions } = createElement(appComponent)
5252
const slots = buildSlots(children, context, functionalContext, componentOptions)
@@ -58,8 +58,18 @@
5858
}
5959
})
6060
61+
const staticClass = {}
62+
if (data.staticClass) {
63+
data.staticClass.split(/\s+/).forEach(name => {
64+
if (name.length === 0) return
65+
staticClass[name] = true
66+
})
67+
}
68+
6169
return createElement(appComponent, {
62-
attrs: props
70+
attrs: props,
71+
class: {...staticClass, ...data.class},
72+
style: {...data.staticStyle, ...data.style},
6373
}, slots)
6474
}
6575
}

0 commit comments

Comments
 (0)