From 609de24f197779c7ff9ccd5a2a07be9c9e3352e5 Mon Sep 17 00:00:00 2001 From: undefined Date: Fri, 2 Oct 2020 15:39:36 +0800 Subject: [PATCH] refactor: revert vc-xxx --- antdv-demo | 2 +- .../{index.tsx => index.jsx} | 19 +++++++------------ webpack.config.js | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) rename components/vc-resize-observer/{index.tsx => index.jsx} (85%) diff --git a/antdv-demo b/antdv-demo index 955716e4e..79d49c0ff 160000 --- a/antdv-demo +++ b/antdv-demo @@ -1 +1 @@ -Subproject commit 955716e4e9533bc628c651d6ba6c8d1eb9b21a9d +Subproject commit 79d49c0ff31a4f505ccd5bc3ad238c08f9925212 diff --git a/components/vc-resize-observer/index.tsx b/components/vc-resize-observer/index.jsx similarity index 85% rename from components/vc-resize-observer/index.tsx rename to components/vc-resize-observer/index.jsx index 8c5403e14..3f7a8d822 100644 --- a/components/vc-resize-observer/index.tsx +++ b/components/vc-resize-observer/index.jsx @@ -1,24 +1,19 @@ // based on rc-resize-observer 0.1.3 -import { defineComponent, PropType } from 'vue'; import ResizeObserver from 'resize-observer-polyfill'; import BaseMixin from '../_util/BaseMixin'; import { findDOMNode } from '../_util/props-util'; // Still need to be compatible with React 15, we use class component here -const VueResizeObserver = defineComponent({ +const VueResizeObserver = { name: 'ResizeObserver', mixins: [BaseMixin], props: { disabled: Boolean, - onResize: Function as PropType< - (size: { width: number; height: number; offsetWidth: number; offsetHeight: number }) => void - >, - }, - beforeCreate() { - this.currentElement = null; - this.resizeObserver = null; + onResize: Function, }, data() { + this.currentElement = null; + this.resizeObserver = null; return { width: 0, height: 0, @@ -59,7 +54,7 @@ const VueResizeObserver = defineComponent({ } }, - handleResize(entries: ResizeObserverEntry[]) { + handleResize(entries) { const { target } = entries[0]; const { width, height } = target.getBoundingClientRect(); /** @@ -87,8 +82,8 @@ const VueResizeObserver = defineComponent({ }, render() { - return this.$slots.default?.()[0]; + return this.$slots.default && this.$slots.default()[0]; }, -}); +}; export default VueResizeObserver; diff --git a/webpack.config.js b/webpack.config.js index cf6dd7314..4991a84af 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -33,7 +33,7 @@ const babelConfig = { style: true, }, ], - ['@vue/babel-plugin-jsx', { optimize: true }], + ['@vue/babel-plugin-jsx'], '@babel/plugin-proposal-optional-chaining', '@babel/plugin-transform-object-assign', '@babel/plugin-proposal-object-rest-spread',