Skip to content

Commit

Permalink
feat(MdApp): custom class and style (#1256)
Browse files Browse the repository at this point in the history
1254
  • Loading branch information
VdustR authored and marcosmoura committed Dec 5, 2017
1 parent 72bba16 commit 9073313
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/components/MdApp/MdApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
export default {
name: 'MdApp',
functional: true,
render (createElement, { children, props }) {
render (createElement, { children, props, data }) {
let appComponent = MdAppSideDrawer
const { context, functionalContext, componentOptions } = createElement(appComponent)
const slots = buildSlots(children, context, functionalContext, componentOptions)
Expand All @@ -58,8 +58,18 @@
}
})
const staticClass = {}
if (data.staticClass) {
data.staticClass.split(/\s+/).forEach(name => {
if (name.length === 0) return
staticClass[name] = true
})
}
return createElement(appComponent, {
attrs: props
attrs: props,
class: {...staticClass, ...data.class},
style: {...data.staticStyle, ...data.style},
}, slots)
}
}
Expand Down

0 comments on commit 9073313

Please sign in to comment.