feat(layout): themed-style

This commit is contained in:
07akioni 2020-05-30 13:51:20 +08:00
parent 1b08fe1bfe
commit 3f9a052c7b

View File

@ -7,10 +7,7 @@
[`n-${syntheticTheme}-theme`]: syntheticTheme, [`n-${syntheticTheme}-theme`]: syntheticTheme,
[`n-layout--${siderCollapseMode}-collapse-mode`]: siderCollapseMode [`n-layout--${siderCollapseMode}-collapse-mode`]: siderCollapseMode
}" }"
:style="{ :style="syntheticStyle"
marginLeft: styleMarginLeft,
transition: transitionDisabled ? 'none' : null
}"
> >
<n-scrollbar <n-scrollbar
v-if="!useNativeScrollbar" v-if="!useNativeScrollbar"
@ -54,6 +51,10 @@ export default {
scrollContainerStyle: { scrollContainerStyle: {
type: Object, type: Object,
default: null default: null
},
themedStyle: {
type: Object,
default: null
} }
}, },
data () { data () {
@ -80,6 +81,13 @@ export default {
} }
return null return null
}, },
syntheticStyle () {
const themedStyle = this.themedStyle
return Object.assign({
marginLeft: this.styleMarginLeft,
transition: this.transitionDisabled ? 'none' : null
}, themedStyle ? themedStyle[this.syntheticTheme] : null)
},
transitionDisabled () { transitionDisabled () {
if (this.NLayout && this.NLayout.childLayoutTransitionDisabled) { if (this.NLayout && this.NLayout.childLayoutTransitionDisabled) {
return true return true