Skip to content

Commit

Permalink
fix: add resize-observer-polyfill #4508
Browse files Browse the repository at this point in the history
close #4508
  • Loading branch information
tangjinzhou committed Aug 12, 2021
1 parent 8187d3a commit 9f15fe9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions components/vc-align/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import contains from '../vc-util/Dom/contains';
import type { TargetPoint } from './interface';
import ResizeObserver from 'resize-observer-polyfill';

export function isSamePoint(prev: TargetPoint, next: TargetPoint) {
if (prev === next) return true;
Expand Down
7 changes: 3 additions & 4 deletions components/vc-resize-observer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// based on rc-resize-observer 1.0.0
import type { PropType } from 'vue';
import ResizeObserver from 'resize-observer-polyfill';
import {
defineComponent,
getCurrentInstance,
Expand All @@ -18,7 +19,7 @@ interface ResizeObserverState {
offsetWidth: number;
}

const ResizeObserver = defineComponent({
export default defineComponent({
name: 'ResizeObserver',
props: {
disabled: Boolean,
Expand Down Expand Up @@ -110,7 +111,7 @@ const ResizeObserver = defineComponent({
}

if (!resizeObserver && element) {
resizeObserver = new window.ResizeObserver(onResize);
resizeObserver = new ResizeObserver(onResize);
resizeObserver.observe(element);
}
};
Expand All @@ -135,5 +136,3 @@ const ResizeObserver = defineComponent({
};
},
});

export default ResizeObserver;
1 change: 1 addition & 0 deletions components/vc-slick/src/inner-slider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import debounce from 'lodash-es/debounce';
import ResizeObserver from 'resize-observer-polyfill';
import classnames from '../../_util/classNames';
import BaseMixin from '../../_util/BaseMixin';
import defaultProps from './default-props';
Expand Down
1 change: 1 addition & 0 deletions components/vc-tabs/src/ScrollableTabBarNode.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import debounce from 'lodash-es/debounce';
import ResizeObserver from 'resize-observer-polyfill';
import PropTypes from '../../_util/vue-types';
import BaseMixin from '../../_util/BaseMixin';
import { getComponent, getSlot } from '../../_util/props-util';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@
"querystring": "^0.2.0",
"raw-loader": "^4.0.2",
"reqwest": "^2.0.5",
"resize-observer-polyfill": "^1.5.1",
"rimraf": "^3.0.0",
"rucksack-css": "^1.0.2",
"selenium-server": "^3.0.1",
Expand Down Expand Up @@ -214,6 +213,7 @@
"lodash-es": "^4.17.15",
"moment": "^2.27.0",
"omit.js": "^2.0.0",
"resize-observer-polyfill": "^1.5.1",
"scroll-into-view-if-needed": "^2.2.25",
"shallow-equal": "^1.0.0",
"vue-types": "^3.0.0",
Expand Down

0 comments on commit 9f15fe9

Please sign in to comment.