diff --git a/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap index 688d5207a..4bbd01d5d 100644 --- a/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap +++ b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Drawer class is test_drawer 1`] = ` -
+
@@ -16,7 +16,7 @@ exports[`Drawer class is test_drawer 1`] = ` `; exports[`Drawer closable is false 1`] = ` -
+
@@ -31,7 +31,7 @@ exports[`Drawer closable is false 1`] = ` `; exports[`Drawer destroyOnClose is true 1`] = ` -
+
@@ -46,7 +46,7 @@ exports[`Drawer destroyOnClose is true 1`] = ` `; exports[`Drawer have a title 1`] = ` -
+
@@ -64,7 +64,7 @@ exports[`Drawer have a title 1`] = ` `; exports[`Drawer render correctly 1`] = ` -
+
@@ -79,7 +79,7 @@ exports[`Drawer render correctly 1`] = ` `; exports[`Drawer render top drawer 1`] = ` -
+
diff --git a/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap b/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap index efd6a7c4e..7b7a6091f 100644 --- a/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap +++ b/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap @@ -2,7 +2,7 @@ exports[`Drawer render correctly 1`] = `
-
+
diff --git a/components/drawer/index.jsx b/components/drawer/index.jsx index 9a6054d12..dd6f83b9b 100644 --- a/components/drawer/index.jsx +++ b/components/drawer/index.jsx @@ -1,9 +1,10 @@ import warning from 'warning' +import classnames from 'classnames' import VcDrawer from '../vc-drawer/src' import PropTypes from '../_util/vue-types' import BaseMixin from '../_util/BaseMixin' import Icon from '../icon' -import { getComponentFromProp, getOptionProps, getClass } from '../_util/props-util' +import { getComponentFromProp, getOptionProps } from '../_util/props-util' const Drawer = { name: 'ADrawer', @@ -22,14 +23,10 @@ const Drawer = { prefixCls: PropTypes.string.def('ant-drawer'), placement: PropTypes.oneOf(['top', 'right', 'bottom', 'left']).def('right'), level: PropTypes.any.def(null), - wrapClassName: PropTypes.string, + wrapClassName: PropTypes.string, // not use class like react, vue will add class to root dom }, mixins: [BaseMixin], data () { - warning( - this.wrapClassName === undefined, - 'wrapClassName is deprecated, please use className instead.', - ) this.destoryClose = false this.preVisible = this.$props.visible return { @@ -199,17 +196,16 @@ const Drawer = { open: visible, showMask: props.mask, placement, + className: classnames({ + [wrapClassName]: !!wrapClassName, + [haveMask]: !!haveMask, + }), }, on: { maskClick: this.onMaskClick, ...this.$listeners, }, style: this.getRcDrawerStyle(), - class: { - [wrapClassName]: !!wrapClassName, - ...getClass(this), - [haveMask]: !!haveMask, - }, } return (
-
+
longgggggggggggggggggggggggggggggggggg
diff --git a/components/vc-drawer/src/Drawer.js b/components/vc-drawer/src/Drawer.js index 6e7c2f6c7..dc6f9f983 100644 --- a/components/vc-drawer/src/Drawer.js +++ b/components/vc-drawer/src/Drawer.js @@ -41,6 +41,7 @@ const Drawer = { handler: true, maskStyle: {}, wrapperClassName: '', + className: '', }), data () { this.levelDom = [] @@ -367,6 +368,7 @@ const Drawer = { }, getChildToRender (open) { const { + className, prefixCls, placement, handler, @@ -379,7 +381,7 @@ const Drawer = { const wrapperClassname = classnames(prefixCls, { [`${prefixCls}-${placement}`]: true, [`${prefixCls}-open`]: open, - ...getClass(this), + [className]: !!className, }) const isOpenChange = this.isOpenChange const isHorizontal = placement === 'left' || placement === 'right' diff --git a/components/vc-drawer/src/drawerProps.js b/components/vc-drawer/src/drawerProps.js index d8088b53a..fabfb4555 100644 --- a/components/vc-drawer/src/drawerProps.js +++ b/components/vc-drawer/src/drawerProps.js @@ -17,4 +17,5 @@ export default { handler: PropTypes.any, showMask: PropTypes.bool, maskStyle: PropTypes.object, + className: PropTypes.string, } diff --git a/tests/__snapshots__/index.test.js.snap b/tests/__snapshots__/index.test.js.snap index 630b490cd..517bff8a6 100644 --- a/tests/__snapshots__/index.test.js.snap +++ b/tests/__snapshots__/index.test.js.snap @@ -58,6 +58,7 @@ Array [ "Upload", "Drawer", "Skeleton", + "Comment", "default", ] `;