refactor: use findDomNode instead $el
parent
45c899dab1
commit
7e15533f52
|
@ -116,7 +116,7 @@ const getSlotOptions = () => {
|
||||||
throw Error('使用 .type 直接取值');
|
throw Error('使用 .type 直接取值');
|
||||||
};
|
};
|
||||||
const findDOMNode = instance => {
|
const findDOMNode = instance => {
|
||||||
let node = instance.$el || instance;
|
let node = instance && (instance.$el || instance);
|
||||||
while (node && !node.tagName) {
|
while (node && !node.tagName) {
|
||||||
node = node.nextSibling;
|
node = node.nextSibling;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { nextTick, inject } from 'vue';
|
||||||
import TransitionEvents from './css-animation/Event';
|
import TransitionEvents from './css-animation/Event';
|
||||||
import raf from './raf';
|
import raf from './raf';
|
||||||
import { ConfigConsumerProps } from '../config-provider';
|
import { ConfigConsumerProps } from '../config-provider';
|
||||||
|
import { findDOMNode } from './props-util';
|
||||||
let styleForPesudo;
|
let styleForPesudo;
|
||||||
|
|
||||||
// Where el is the DOM element you'd like to test for visibility
|
// Where el is the DOM element you'd like to test for visibility
|
||||||
|
@ -24,7 +25,7 @@ export default {
|
||||||
props: ['insertExtraNode'],
|
props: ['insertExtraNode'],
|
||||||
mounted() {
|
mounted() {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const node = this.$el;
|
const node = findDOMNode(this);
|
||||||
if (node.nodeType !== 1) {
|
if (node.nodeType !== 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +91,7 @@ export default {
|
||||||
onTransitionStart(e) {
|
onTransitionStart(e) {
|
||||||
if (this.destroy) return;
|
if (this.destroy) return;
|
||||||
|
|
||||||
const node = this.$el;
|
const node = findDOMNode(this);
|
||||||
if (!e || e.target !== node) {
|
if (!e || e.target !== node) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import classNames from 'classnames';
|
||||||
import BaseMixin from '../_util/BaseMixin';
|
import BaseMixin from '../_util/BaseMixin';
|
||||||
import PropTypes from '../_util/vue-types';
|
import PropTypes from '../_util/vue-types';
|
||||||
import getTransitionProps from '../_util/getTransitionProps';
|
import getTransitionProps from '../_util/getTransitionProps';
|
||||||
import { getComponent, isValidElement } from '../_util/props-util';
|
import { getComponent, isValidElement, findDOMNode } from '../_util/props-util';
|
||||||
import { ConfigConsumerProps } from '../config-provider';
|
import { ConfigConsumerProps } from '../config-provider';
|
||||||
|
|
||||||
function noop() {}
|
function noop() {}
|
||||||
|
@ -74,7 +74,7 @@ const Alert = {
|
||||||
methods: {
|
methods: {
|
||||||
handleClose(e) {
|
handleClose(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const dom = this.$el;
|
const dom = findDOMNode(this);
|
||||||
dom.style.height = `${dom.offsetHeight}px`;
|
dom.style.height = `${dom.offsetHeight}px`;
|
||||||
// Magic code
|
// Magic code
|
||||||
// 重复一次后才能正确设置 height
|
// 重复一次后才能正确设置 height
|
||||||
|
|
|
@ -5,7 +5,7 @@ import addEventListener from '../vc-util/Dom/addEventListener';
|
||||||
import Affix from '../affix';
|
import Affix from '../affix';
|
||||||
import scrollTo from '../_util/scrollTo';
|
import scrollTo from '../_util/scrollTo';
|
||||||
import getScroll from '../_util/getScroll';
|
import getScroll from '../_util/getScroll';
|
||||||
import { initDefaultProps } from '../_util/props-util';
|
import { initDefaultProps, findDOMNode } from '../_util/props-util';
|
||||||
import BaseMixin from '../_util/BaseMixin';
|
import BaseMixin from '../_util/BaseMixin';
|
||||||
import { ConfigConsumerProps } from '../config-provider';
|
import { ConfigConsumerProps } from '../config-provider';
|
||||||
|
|
||||||
|
@ -253,7 +253,9 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { _sPrefixCls } = this;
|
const { _sPrefixCls } = this;
|
||||||
const linkNode = this.$el.getElementsByClassName(`${_sPrefixCls}-link-title-active`)[0];
|
const linkNode = findDOMNode(this).getElementsByClassName(
|
||||||
|
`${_sPrefixCls}-link-title-active`,
|
||||||
|
)[0];
|
||||||
if (linkNode) {
|
if (linkNode) {
|
||||||
this.$refs.inkNode.style.top = `${linkNode.offsetTop + linkNode.clientHeight / 2 - 4.5}px`;
|
this.$refs.inkNode.style.top = `${linkNode.offsetTop + linkNode.clientHeight / 2 - 4.5}px`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import LocaleReceiver from '../locale-provider/LocaleReceiver';
|
||||||
import enUS from './locale/en_US';
|
import enUS from './locale/en_US';
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
|
|
||||||
import { getOptionProps } from '../_util/props-util';
|
import { getOptionProps, findDOMNode } from '../_util/props-util';
|
||||||
let colors = '#194d33';
|
let colors = '#194d33';
|
||||||
export default {
|
export default {
|
||||||
name: 'AColorPicker',
|
name: 'AColorPicker',
|
||||||
|
@ -90,7 +90,7 @@ export default {
|
||||||
this.pickr.destroyAndRemove();
|
this.pickr.destroyAndRemove();
|
||||||
const dom = document.createElement('div');
|
const dom = document.createElement('div');
|
||||||
dom.id = 'color-picker' + this._uid;
|
dom.id = 'color-picker' + this._uid;
|
||||||
const box = this.$el.querySelector('#color-picker-box' + this._uid);
|
const box = findDOMNode(this).querySelector('#color-picker-box' + this._uid);
|
||||||
box.appendChild(dom);
|
box.appendChild(dom);
|
||||||
this.createPickr();
|
this.createPickr();
|
||||||
this.eventsBinding();
|
this.eventsBinding();
|
||||||
|
@ -122,7 +122,7 @@ export default {
|
||||||
Object.assign(
|
Object.assign(
|
||||||
{
|
{
|
||||||
el: '#color-picker' + this._uid,
|
el: '#color-picker' + this._uid,
|
||||||
container: (container && container(this.$el)) || document.body,
|
container: (container && container(findDOMNode(this))) || document.body,
|
||||||
theme: 'monolith', // or 'monolith', or 'nano'
|
theme: 'monolith', // or 'monolith', or 'nano'
|
||||||
default: this.value || this.defaultValue || null, // 有默认颜色pickr才可以获取到_representation
|
default: this.value || this.defaultValue || null, // 有默认颜色pickr才可以获取到_representation
|
||||||
components: {
|
components: {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import PropTypes from '../_util/vue-types';
|
||||||
import Button from '../button';
|
import Button from '../button';
|
||||||
import BaseMixin from '../_util/BaseMixin';
|
import BaseMixin from '../_util/BaseMixin';
|
||||||
import buttonTypes from '../button/buttonTypes';
|
import buttonTypes from '../button/buttonTypes';
|
||||||
import { getSlot } from '../_util/props-util';
|
import { getSlot, findDOMNode } from '../_util/props-util';
|
||||||
const ButtonType = buttonTypes().type;
|
const ButtonType = buttonTypes().type;
|
||||||
const ActionButtonProps = {
|
const ActionButtonProps = {
|
||||||
type: ButtonType,
|
type: ButtonType,
|
||||||
|
@ -22,7 +22,7 @@ export default {
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.autofocus) {
|
if (this.autofocus) {
|
||||||
this.timeoutId = setTimeout(() => this.$el.focus());
|
this.timeoutId = setTimeout(() => findDOMNode(this).focus());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import Checkbox from '../checkbox';
|
||||||
import Radio from '../radio';
|
import Radio from '../radio';
|
||||||
import FilterDropdownMenuWrapper from './FilterDropdownMenuWrapper';
|
import FilterDropdownMenuWrapper from './FilterDropdownMenuWrapper';
|
||||||
import { FilterMenuProps } from './interface';
|
import { FilterMenuProps } from './interface';
|
||||||
import { initDefaultProps, getOptionProps, isValidElement } from '../_util/props-util';
|
import { initDefaultProps, getOptionProps, isValidElement, findDOMNode } from '../_util/props-util';
|
||||||
import { cloneElement } from '../_util/vnode';
|
import { cloneElement } from '../_util/vnode';
|
||||||
import BaseMixin from '../_util/BaseMixin';
|
import BaseMixin from '../_util/BaseMixin';
|
||||||
import { generateValueMaps } from './util';
|
import { generateValueMaps } from './util';
|
||||||
|
@ -98,7 +98,7 @@ export default {
|
||||||
return this.neverShown ? false : this.sVisible;
|
return this.neverShown ? false : this.sVisible;
|
||||||
},
|
},
|
||||||
setNeverShown(column) {
|
setNeverShown(column) {
|
||||||
const rootNode = this.$el;
|
const rootNode = findDOMNode(this);
|
||||||
const filterBelongToScrollBody = !!closest(rootNode, `.ant-table-scroll`);
|
const filterBelongToScrollBody = !!closest(rootNode, `.ant-table-scroll`);
|
||||||
if (filterBelongToScrollBody) {
|
if (filterBelongToScrollBody) {
|
||||||
// When fixed column have filters, there will be two dropdown menus
|
// When fixed column have filters, there will be two dropdown menus
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import PropTypes from '../_util/vue-types';
|
import PropTypes from '../_util/vue-types';
|
||||||
import { isValidElement, initDefaultProps, splitAttrs } from '../_util/props-util';
|
import { isValidElement, initDefaultProps, splitAttrs, findDOMNode } from '../_util/props-util';
|
||||||
import BaseMixin from '../_util/BaseMixin';
|
import BaseMixin from '../_util/BaseMixin';
|
||||||
import Checkbox from '../checkbox';
|
import Checkbox from '../checkbox';
|
||||||
import Search from './search';
|
import Search from './search';
|
||||||
|
@ -230,7 +230,7 @@ export default {
|
||||||
// Manually trigger scroll event for lazy search bug
|
// Manually trigger scroll event for lazy search bug
|
||||||
// https://github.com/ant-design/ant-design/issues/5631
|
// https://github.com/ant-design/ant-design/issues/5631
|
||||||
this.triggerScrollTimer = setTimeout(() => {
|
this.triggerScrollTimer = setTimeout(() => {
|
||||||
const transferNode = this.$el;
|
const transferNode = findDOMNode(this);
|
||||||
const listNode = transferNode.querySelectorAll('.ant-transfer-list-content')[0];
|
const listNode = transferNode.querySelectorAll('.ant-transfer-list-content')[0];
|
||||||
if (listNode) {
|
if (listNode) {
|
||||||
triggerEvent(listNode, 'scroll');
|
triggerEvent(listNode, 'scroll');
|
||||||
|
|
|
@ -3,6 +3,7 @@ import raf from '../_util/raf';
|
||||||
import ListItem from './ListItem';
|
import ListItem from './ListItem';
|
||||||
import PropTypes from '../_util/vue-types';
|
import PropTypes from '../_util/vue-types';
|
||||||
import getTransitionProps from '../_util/getTransitionProps';
|
import getTransitionProps from '../_util/getTransitionProps';
|
||||||
|
import { findDOMNode } from '../_util/props-util';
|
||||||
function noop() {}
|
function noop() {}
|
||||||
const ListBody = {
|
const ListBody = {
|
||||||
name: 'ListBody',
|
name: 'ListBody',
|
||||||
|
@ -29,7 +30,7 @@ const ListBody = {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const { lazy } = this.$props;
|
const { lazy } = this.$props;
|
||||||
if (lazy !== false) {
|
if (lazy !== false) {
|
||||||
const container = this.$el;
|
const container = findDOMNode(this);
|
||||||
raf.cancel(this.lazyId);
|
raf.cancel(this.lazyId);
|
||||||
this.lazyId = raf(() => {
|
this.lazyId = raf(() => {
|
||||||
if (container) {
|
if (container) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ export default {
|
||||||
const props = this.$props;
|
const props = this.$props;
|
||||||
let reAlign = false;
|
let reAlign = false;
|
||||||
if (!props.disabled) {
|
if (!props.disabled) {
|
||||||
const source = this.$el;
|
const source = findDOMNode(this);
|
||||||
const sourceRect = source ? source.getBoundingClientRect() : null;
|
const sourceRect = source ? source.getBoundingClientRect() : null;
|
||||||
|
|
||||||
if (prevProps.disabled) {
|
if (prevProps.disabled) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import PropTypes from '../../_util/vue-types';
|
import PropTypes from '../../_util/vue-types';
|
||||||
import BaseMixin from '../../_util/BaseMixin';
|
import BaseMixin from '../../_util/BaseMixin';
|
||||||
import { getOptionProps, hasProp, getComponent } from '../../_util/props-util';
|
import { getOptionProps, hasProp, getComponent, findDOMNode } from '../../_util/props-util';
|
||||||
import { cloneElement } from '../../_util/vnode';
|
import { cloneElement } from '../../_util/vnode';
|
||||||
import KeyCode from '../../_util/KeyCode';
|
import KeyCode from '../../_util/KeyCode';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
@ -232,7 +232,7 @@ const Calendar = {
|
||||||
},
|
},
|
||||||
|
|
||||||
getRootDOMNode() {
|
getRootDOMNode() {
|
||||||
return this.$el;
|
return findDOMNode(this);
|
||||||
},
|
},
|
||||||
openTimePicker() {
|
openTimePicker() {
|
||||||
this.onPanelChange(null, 'time');
|
this.onPanelChange(null, 'time');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import PropTypes from '../../../_util/vue-types';
|
import PropTypes from '../../../_util/vue-types';
|
||||||
import BaseMixin from '../../../_util/BaseMixin';
|
import BaseMixin from '../../../_util/BaseMixin';
|
||||||
import { getOptionProps } from '../../../_util/props-util';
|
import { getOptionProps, findDOMNode } from '../../../_util/props-util';
|
||||||
import TodayButton from './TodayButton';
|
import TodayButton from './TodayButton';
|
||||||
import OkButton from './OkButton';
|
import OkButton from './OkButton';
|
||||||
import TimePickerButton from './TimePickerButton';
|
import TimePickerButton from './TimePickerButton';
|
||||||
|
@ -33,7 +33,7 @@ const CalendarFooter = {
|
||||||
},
|
},
|
||||||
|
|
||||||
getRootDOMNode() {
|
getRootDOMNode() {
|
||||||
return this.$el;
|
return findDOMNode(this);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import PropTypes from '../../../_util/vue-types';
|
import PropTypes from '../../../_util/vue-types';
|
||||||
import BaseMixin from '../../../_util/BaseMixin';
|
import BaseMixin from '../../../_util/BaseMixin';
|
||||||
import { getComponent } from '../../../_util/props-util';
|
import { getComponent, findDOMNode } from '../../../_util/props-util';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { formatDate } from '../util';
|
import { formatDate } from '../util';
|
||||||
import KeyCode from '../../../_util/KeyCode';
|
import KeyCode from '../../../_util/KeyCode';
|
||||||
|
@ -164,7 +164,7 @@ const DateInput = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getRootDOMNode() {
|
getRootDOMNode() {
|
||||||
return this.$el;
|
return findDOMNode(this);
|
||||||
},
|
},
|
||||||
focus() {
|
focus() {
|
||||||
if (dateInputInstance) {
|
if (dateInputInstance) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { provide, Transition } from 'vue';
|
import { provide, Transition } from 'vue';
|
||||||
import { initDefaultProps, getSlot } from '../_util/props-util';
|
import { initDefaultProps, getSlot, findDOMNode } from '../_util/props-util';
|
||||||
import KeyCode from '../_util/KeyCode';
|
import KeyCode from '../_util/KeyCode';
|
||||||
import contains from '../vc-util/Dom/contains';
|
import contains from '../vc-util/Dom/contains';
|
||||||
import LazyRenderBox from './LazyRenderBox';
|
import LazyRenderBox from './LazyRenderBox';
|
||||||
|
@ -116,7 +116,7 @@ export default {
|
||||||
this.switchScrollingEffect();
|
this.switchScrollingEffect();
|
||||||
// this.$refs.wrap.focus()
|
// this.$refs.wrap.focus()
|
||||||
this.tryFocus();
|
this.tryFocus();
|
||||||
const dialogNode = this.$refs.dialog.$el;
|
const dialogNode = findDOMNode(this.$refs.dialog);
|
||||||
if (mousePosition) {
|
if (mousePosition) {
|
||||||
const elOffset = offset(dialogNode);
|
const elOffset = offset(dialogNode);
|
||||||
setTransformOrigin(
|
setTransformOrigin(
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
import PropTypes from '../../_util/vue-types';
|
import PropTypes from '../../_util/vue-types';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import KeyCode from '../../_util/KeyCode';
|
import KeyCode from '../../_util/KeyCode';
|
||||||
import { initDefaultProps, hasProp, getOptionProps, getComponent } from '../../_util/props-util';
|
import {
|
||||||
|
initDefaultProps,
|
||||||
|
hasProp,
|
||||||
|
getOptionProps,
|
||||||
|
getComponent,
|
||||||
|
findDOMNode,
|
||||||
|
} from '../../_util/props-util';
|
||||||
import BaseMixin from '../../_util/BaseMixin';
|
import BaseMixin from '../../_util/BaseMixin';
|
||||||
import { getOffsetLeft } from './util';
|
import { getOffsetLeft } from './util';
|
||||||
import Star from './Star';
|
import Star from './Star';
|
||||||
|
@ -129,7 +135,7 @@ export default {
|
||||||
this.__emit('keydown', event);
|
this.__emit('keydown', event);
|
||||||
},
|
},
|
||||||
getStarDOM(index) {
|
getStarDOM(index) {
|
||||||
return this.$refs['stars' + index].$el;
|
return findDOMNode(this.$refs['stars' + index]);
|
||||||
},
|
},
|
||||||
getStarValue(index, x) {
|
getStarValue(index, x) {
|
||||||
let value = index + 1;
|
let value = index + 1;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// based on rc-resize-observer 0.1.3
|
// based on rc-resize-observer 0.1.3
|
||||||
import ResizeObserver from 'resize-observer-polyfill';
|
import ResizeObserver from 'resize-observer-polyfill';
|
||||||
import BaseMixin from '../_util/BaseMixin';
|
import BaseMixin from '../_util/BaseMixin';
|
||||||
|
import { findDOMNode } from '../_util/props-util';
|
||||||
|
|
||||||
// Still need to be compatible with React 15, we use class component here
|
// Still need to be compatible with React 15, we use class component here
|
||||||
const VueResizeObserver = {
|
const VueResizeObserver = {
|
||||||
|
@ -40,7 +41,7 @@ const VueResizeObserver = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unregister if element changed
|
// Unregister if element changed
|
||||||
const element = this.$el;
|
const element = findDOMNode(this);
|
||||||
const elementChanged = element !== this.currentElement;
|
const elementChanged = element !== this.currentElement;
|
||||||
if (elementChanged) {
|
if (elementChanged) {
|
||||||
this.destroyObserver();
|
this.destroyObserver();
|
||||||
|
|
|
@ -73,7 +73,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
scrollActiveItemToView() {
|
scrollActiveItemToView() {
|
||||||
// scroll into view
|
// scroll into view
|
||||||
const itemComponent = this.firstActiveItem && this.firstActiveItem.$el;
|
const itemComponent = this.firstActiveItem && findDOMNode(this.firstActiveItem);
|
||||||
const props = this.$props;
|
const props = this.$props;
|
||||||
const { value, visible, firstActiveValue } = props;
|
const { value, visible, firstActiveValue } = props;
|
||||||
if (!itemComponent || !visible) {
|
if (!itemComponent || !visible) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import {
|
||||||
getEvents,
|
getEvents,
|
||||||
getOptionProps,
|
getOptionProps,
|
||||||
getSlot,
|
getSlot,
|
||||||
|
findDOMNode,
|
||||||
} from '../_util/props-util';
|
} from '../_util/props-util';
|
||||||
import getTransitionProps from '../_util/getTransitionProps';
|
import getTransitionProps from '../_util/getTransitionProps';
|
||||||
import { cloneElement } from '../_util/vnode';
|
import { cloneElement } from '../_util/vnode';
|
||||||
|
@ -471,16 +472,13 @@ const Select = {
|
||||||
|
|
||||||
onMenuDeselect({ item, domEvent }) {
|
onMenuDeselect({ item, domEvent }) {
|
||||||
if (domEvent.type === 'keydown' && domEvent.keyCode === KeyCode.ENTER) {
|
if (domEvent.type === 'keydown' && domEvent.keyCode === KeyCode.ENTER) {
|
||||||
const menuItemDomNode = item.$el;
|
const menuItemDomNode = findDOMNode(item);
|
||||||
// https://github.com/ant-design/ant-design/issues/20465#issuecomment-569033796
|
// https://github.com/ant-design/ant-design/issues/20465#issuecomment-569033796
|
||||||
if (!isHidden(menuItemDomNode)) {
|
if (!isHidden(menuItemDomNode)) {
|
||||||
this.removeSelected(getValuePropValue(item));
|
this.removeSelected(getValuePropValue(item));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (domEvent.type === 'click') {
|
|
||||||
this.removeSelected(getValuePropValue(item));
|
|
||||||
}
|
|
||||||
if (this.autoClearSearchValue) {
|
if (this.autoClearSearchValue) {
|
||||||
this.setInputValue('');
|
this.setInputValue('');
|
||||||
}
|
}
|
||||||
|
@ -676,15 +674,13 @@ const Select = {
|
||||||
(e.relatedTarget === this.$refs.arrow ||
|
(e.relatedTarget === this.$refs.arrow ||
|
||||||
(target &&
|
(target &&
|
||||||
this.selectTriggerRef &&
|
this.selectTriggerRef &&
|
||||||
this.selectTriggerRef.getInnerMenu() &&
|
findDOMNode(this.selectTriggerRef.getInnerMenu()) === target) ||
|
||||||
this.selectTriggerRef.getInnerMenu().$el === target) ||
|
|
||||||
contains(e.target, target))
|
contains(e.target, target))
|
||||||
) {
|
) {
|
||||||
e.target.focus();
|
e.target.focus();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.clearBlurTime();
|
|
||||||
if (this.disabled) {
|
if (this.disabled) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2,6 +2,7 @@ import PropTypes from '../_util/vue-types';
|
||||||
import BaseMixin from '../_util/BaseMixin';
|
import BaseMixin from '../_util/BaseMixin';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import raf from 'raf';
|
import raf from 'raf';
|
||||||
|
import { findDOMNode } from '../_util/props-util';
|
||||||
|
|
||||||
function noop() {}
|
function noop() {}
|
||||||
const scrollTo = (element, to, duration) => {
|
const scrollTo = (element, to, duration) => {
|
||||||
|
@ -109,7 +110,7 @@ const Select = {
|
||||||
|
|
||||||
scrollToSelected(duration) {
|
scrollToSelected(duration) {
|
||||||
// move to selected item
|
// move to selected item
|
||||||
const select = this.$el;
|
const select = findDOMNode(this);
|
||||||
const list = this.$refs.list;
|
const list = this.$refs.list;
|
||||||
if (!list) {
|
if (!list) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -236,7 +236,7 @@ const Select = {
|
||||||
if (treeNode) {
|
if (treeNode) {
|
||||||
const domNode = findDOMNode(treeNode);
|
const domNode = findDOMNode(treeNode);
|
||||||
raf(() => {
|
raf(() => {
|
||||||
const popupNode = this.popup.$el;
|
const popupNode = findDOMNode(this.popup);
|
||||||
const triggerContainer = findPopupContainer(popupNode, `${prefixCls}-dropdown`);
|
const triggerContainer = findPopupContainer(popupNode, `${prefixCls}-dropdown`);
|
||||||
const searchNode = this.popup.searchRef.current;
|
const searchNode = this.popup.searchRef.current;
|
||||||
|
|
||||||
|
|
|
@ -65,13 +65,6 @@ export default {
|
||||||
this.setStretchSize();
|
this.setStretchSize();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// beforeUnmount() {
|
|
||||||
// if (this.$el.parentNode) {
|
|
||||||
// this.$el.parentNode.removeChild(this.$el);
|
|
||||||
// } else if (this.$el.remove) {
|
|
||||||
// this.$el.remove();
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
methods: {
|
methods: {
|
||||||
onAlign(popupDomNode, align) {
|
onAlign(popupDomNode, align) {
|
||||||
const props = this.$props;
|
const props = this.$props;
|
||||||
|
|
|
@ -3,7 +3,7 @@ import BaseMixin from '../../_util/BaseMixin';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import getUid from './uid';
|
import getUid from './uid';
|
||||||
import warning from '../../_util/warning';
|
import warning from '../../_util/warning';
|
||||||
import { getSlot } from '../../_util/props-util';
|
import { getSlot, findDOMNode } from '../../_util/props-util';
|
||||||
|
|
||||||
const IFRAME_STYLE = {
|
const IFRAME_STYLE = {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
|
@ -195,7 +195,7 @@ const IframeUploader = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateIframeWH() {
|
updateIframeWH() {
|
||||||
const rootNode = this.$el;
|
const rootNode = findDOMNode(this);
|
||||||
const iframeNode = this.getIframeNode();
|
const iframeNode = this.getIframeNode();
|
||||||
iframeNode.style.height = `${rootNode.offsetHeight}px`;
|
iframeNode.style.height = `${rootNode.offsetHeight}px`;
|
||||||
iframeNode.style.width = `${rootNode.offsetWidth}px`;
|
iframeNode.style.width = `${rootNode.offsetWidth}px`;
|
||||||
|
|
Loading…
Reference in New Issue