mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-01 11:28:30 +08:00
static 的 target 不监控大小变化
This commit is contained in:
parent
9983812fea
commit
72db95752b
@ -13,7 +13,7 @@ import {findDOMNode} from 'react-dom';
|
||||
import React from 'react';
|
||||
import {calculatePosition, getContainer, ownerDocument} from '../utils/dom';
|
||||
import {autobind} from '../utils/helper';
|
||||
import {resizeSensor} from '../utils/resize-sensor';
|
||||
import {resizeSensor, getComputedStyle} from '../utils/resize-sensor';
|
||||
|
||||
// @ts-ignore
|
||||
BasePosition.propTypes.placement = () => null;
|
||||
@ -38,7 +38,10 @@ class Position extends BasePosition {
|
||||
});
|
||||
}
|
||||
|
||||
if (!this.watchedTarget || this.watchedTarget !== target) {
|
||||
if (
|
||||
(!this.watchedTarget || this.watchedTarget !== target) &&
|
||||
getComputedStyle(target, 'position') !== 'static'
|
||||
) {
|
||||
this.resizeDispose?.();
|
||||
this.watchedTarget = target;
|
||||
this.resizeDispose = resizeSensor(target, () =>
|
||||
|
@ -17,7 +17,7 @@ class EventQueue {
|
||||
}
|
||||
}
|
||||
|
||||
function getComputedStyle(element: HTMLElement, prop: string) {
|
||||
export function getComputedStyle(element: HTMLElement, prop: string) {
|
||||
if ((element as any).currentStyle) {
|
||||
return (element as any).currentStyle[prop];
|
||||
} else if (window.getComputedStyle) {
|
||||
|
Loading…
Reference in New Issue
Block a user