fix(modal, drawer): warning on body-style & body-class

This commit is contained in:
07akioni 2020-12-15 16:35:51 +08:00
parent b4849b4714
commit 3e40af2a44
4 changed files with 18 additions and 10 deletions

View File

@ -104,7 +104,7 @@ export default {
validator () {
warn(
'drawer',
'`draw-style` is deprecated, please use `body-style` instead.'
'`drawer-style` is deprecated, please use `style` instead.'
)
return true
},
@ -114,7 +114,7 @@ export default {
validator () {
warn(
'drawer',
'`draw-class` is deprecated, please use `body-class` instead.'
'`drawer-class` is deprecated, please use `class` instead.'
)
return true
},

View File

@ -24,7 +24,6 @@
<n-dialog
v-if="preset === 'confirm' || preset === 'dialog'"
v-bind="$attrs"
:style="compitableBodyStyle"
:theme="theme"
:title="title"
:closable="closable"
@ -50,7 +49,6 @@
v-else-if="preset === 'card'"
v-bind="$attrs"
:theme="theme"
:style="compitableBodyStyle"
:title="title"
:closable="closable"
:size="size"
@ -82,7 +80,6 @@
<script>
import { nextTick, reactive, toRefs, toRef, watch, ref, inject } from 'vue'
import { clickoutside } from 'vdirs'
import { useCompitable } from 'vooks'
import { NScrollbar } from '../../scrollbar'
import { NDialog } from '../../dialog'
import { NCard } from '../../card'
@ -162,7 +159,6 @@ export default {
return {
NModal,
mousePosition: toRef(NModal, 'mousePosition'),
compitableBodyStyle: useCompitable(props, ['overlayStyle', 'bodyStyle']),
bodyRef: ref(null),
...dataRefs
}

View File

@ -81,6 +81,18 @@ export default {
default: null
},
// deprecated
overlayStyle: {
validator () {
if (__DEV__) {
warn(
'modal',
'`overlay-style` is deprecated, please use `style` instead.'
)
}
return true
},
default: undefined
},
onBeforeHide: {
validator () {
if (__DEV__) {
@ -183,6 +195,10 @@ export default {
NModalBodyWrapper,
{
...this.$attrs,
style: {
...this.$attrs.style,
...this.overlayStyle
},
ref: 'bodyWrapper',
...omit(this.$props, ['maskClosable', 'to']),
theme: this.mergedTheme,

View File

@ -1,8 +1,4 @@
export default {
bodyStyle: {
type: Object,
default: undefined
},
// For preset: confirm, card
title: {
type: String,