Skip to content

Commit 609de24

Browse files
author
undefined
committed
refactor: revert vc-xxx
1 parent 8124653 commit 609de24

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

antdv-demo

components/vc-resize-observer/index.tsx renamed to components/vc-resize-observer/index.jsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
// based on rc-resize-observer 0.1.3
2-
import { defineComponent, PropType } from 'vue';
32
import ResizeObserver from 'resize-observer-polyfill';
43
import BaseMixin from '../_util/BaseMixin';
54
import { findDOMNode } from '../_util/props-util';
65

76
// Still need to be compatible with React 15, we use class component here
8-
const VueResizeObserver = defineComponent({
7+
const VueResizeObserver = {
98
name: 'ResizeObserver',
109
mixins: [BaseMixin],
1110
props: {
1211
disabled: Boolean,
13-
onResize: Function as PropType<
14-
(size: { width: number; height: number; offsetWidth: number; offsetHeight: number }) => void
15-
>,
12+
onResize: Function,
1613
},
17-
beforeCreate() {
14+
data() {
1815
this.currentElement = null;
1916
this.resizeObserver = null;
20-
},
21-
data() {
2217
return {
2318
width: 0,
2419
height: 0,
@@ -59,7 +54,7 @@ const VueResizeObserver = defineComponent({
5954
}
6055
},
6156

62-
handleResize(entries: ResizeObserverEntry[]) {
57+
handleResize(entries) {
6358
const { target } = entries[0];
6459
const { width, height } = target.getBoundingClientRect();
6560
/**
@@ -87,8 +82,8 @@ const VueResizeObserver = defineComponent({
8782
},
8883

8984
render() {
90-
return this.$slots.default?.()[0];
85+
return this.$slots.default && this.$slots.default()[0];
9186
},
92-
});
87+
};
9388

9489
export default VueResizeObserver;

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const babelConfig = {
3333
style: true,
3434
},
3535
],
36-
['@vue/babel-plugin-jsx', { optimize: true }],
36+
['@vue/babel-plugin-jsx'],
3737
'@babel/plugin-proposal-optional-chaining',
3838
'@babel/plugin-transform-object-assign',
3939
'@babel/plugin-proposal-object-rest-spread',

0 commit comments

Comments
 (0)