mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-03 04:21:34 +08:00
feat(message, confirm, notification): make them work as theme context
This commit is contained in:
parent
d0edcb4a61
commit
9c35d19a2b
@ -79,6 +79,7 @@ import iosCloseCircle from '../../_icons/ios-close-circle'
|
||||
import withapp from '../../_mixins/withapp'
|
||||
import themeable from '../../_mixins/themeable'
|
||||
import render from '../../_utils/vue/render'
|
||||
import asthemecontext from '../../_mixins/asthemecontext'
|
||||
|
||||
export default {
|
||||
name: 'NConfirm',
|
||||
@ -91,7 +92,7 @@ export default {
|
||||
iosCloseCircle,
|
||||
render
|
||||
},
|
||||
mixins: [withapp, themeable],
|
||||
mixins: [withapp, themeable, asthemecontext],
|
||||
props: {
|
||||
icon: {
|
||||
type: Function,
|
||||
@ -132,6 +133,10 @@ export default {
|
||||
bordered: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
themeContextActivated: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -14,6 +14,7 @@
|
||||
:negative-text="negativeText"
|
||||
:title="title"
|
||||
:loading="loading"
|
||||
theme-context-activated
|
||||
@close="handleCloseClick"
|
||||
@negative-click="handleNegativeClick"
|
||||
@positive-click="handlePositiveClick"
|
||||
|
@ -7,8 +7,11 @@ import mdCloseCircle from '../../_icons/md-close-circle'
|
||||
import NBaseLoading from '../../_base/Loading'
|
||||
import IconSwitchTransition from '../../_transition/IconSwitchTransition'
|
||||
import render from '../../_utils/vue/render'
|
||||
import themeable from '../../_mixins/themeable'
|
||||
import asthemecontext from '../../_mixins/asthemecontext'
|
||||
|
||||
export default {
|
||||
mixins: [ themeable, asthemecontext ],
|
||||
props: {
|
||||
icon: {
|
||||
type: [String, Function],
|
||||
|
@ -64,6 +64,7 @@ import mdAlert from '../../_icons/md-alert'
|
||||
import mdInformationCircle from '../../_icons/md-information-circle'
|
||||
import mdCloseCircle from '../../_icons/md-close-circle'
|
||||
import render from '../../_utils/vue/render'
|
||||
import asthemecontext from '../../_mixins/asthemecontext'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -75,7 +76,7 @@ export default {
|
||||
mdInformationCircle,
|
||||
mdCloseCircle
|
||||
},
|
||||
mixins: [ themeable ],
|
||||
mixins: [ themeable, asthemecontext ],
|
||||
props: {
|
||||
closable: {
|
||||
type: Boolean,
|
||||
|
@ -1,4 +1,10 @@
|
||||
export default {
|
||||
props: {
|
||||
themeContextActivated: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
provide () {
|
||||
return {
|
||||
NThemedComponent: this
|
||||
|
@ -19,12 +19,17 @@ export default {
|
||||
const theme = this.theme
|
||||
if (theme !== null) {
|
||||
return theme
|
||||
} else if (this.NThemedComponent && this.NThemedComponent.theme) {
|
||||
return this.NThemedComponent.theme
|
||||
} else {
|
||||
const NConfigProvider = this.NConfigProvider
|
||||
return (NConfigProvider && NConfigProvider.syntheticTheme) || null
|
||||
}
|
||||
const NThemedComponent = this.NThemedComponent
|
||||
if (
|
||||
NThemedComponent &&
|
||||
NThemedComponent.theme &&
|
||||
NThemedComponent.themeContextActivated
|
||||
) {
|
||||
return NThemedComponent.theme
|
||||
}
|
||||
const NConfigProvider = this.NConfigProvider
|
||||
return (NConfigProvider && NConfigProvider.syntheticTheme) || null
|
||||
},
|
||||
syntheticStyle () {
|
||||
const themedStyle = this.themedStyle
|
||||
|
Loading…
Reference in New Issue
Block a user