chore: update destory to unmount

pull/2377/head^2
tanjinzhou 2020-06-11 16:13:09 +08:00
parent 7555f2c65b
commit 585bb7495b
61 changed files with 79 additions and 64 deletions

View File

@ -24,7 +24,7 @@ export default {
}
},
beforeDestroy() {
beforeUnmount() {
if (this.autoDestroy) {
this.removeContainer();
}

View File

@ -24,7 +24,7 @@ export default {
}
},
beforeDestroy() {
beforeUnmount() {
this.removeContainer();
},
methods: {

View File

@ -46,7 +46,7 @@ export default {
}
},
},
beforeDestroy() {
beforeUnmount() {
const { visible } = this.$props;
// 离开时不会 render 导到离开时数值不变,改用 func 。。
openCount = visible && openCount ? openCount - 1 : openCount;

View File

@ -1,13 +1,13 @@
const createRef = fn => {
return {
onVnodeBeforeMounted: vnode => {
onVnodeBeforeMount: vnode => {
fn(vnode.component || vnode.el, vnode.key);
},
onVnodeUpdated: vnode => {
fn(vnode.component || vnode.el, vnode.key);
},
onVnodeDestroyed: vnode => {
fn(vnode.component || vnode.el, vnode.key);
onVnodeUnmounted: vnode => {
fn(null, vnode.key);
},
};
};

View File

@ -44,7 +44,7 @@ export default function connect(mapStateToProps) {
this.trySubscribe();
},
beforeDestroy() {
beforeUnmount() {
this.tryUnsubscribe();
},
methods: {

View File

@ -37,7 +37,7 @@ export default {
configProvider,
};
},
beforeDestroy() {
beforeUnmount() {
if (this.instance) {
this.instance.cancel();
}

View File

@ -98,7 +98,7 @@ const Affix = {
this.updatePosition();
},
},
beforeDestroy() {
beforeUnmount() {
clearTimeout(this.timeout);
removeObserveTarget(this);
this.updatePosition.cancel();

View File

@ -152,7 +152,7 @@ export default {
this.updateInk();
});
},
beforeDestroy() {
beforeUnmount() {
if (this.scrollEvent) {
this.scrollEvent.remove();
}

View File

@ -36,7 +36,7 @@ export default {
this.antAnchor.registerLink(this.href);
},
beforeDestroy() {
beforeUnmount() {
this.antAnchor.unregisterLink(this.href);
},
methods: {

View File

@ -44,7 +44,7 @@ const BackTop = {
});
},
beforeDestroy() {
beforeUnmount() {
if (this.scrollEvent) {
this.scrollEvent.remove();
}

View File

@ -65,7 +65,7 @@ export default {
});
}
},
beforeDestroy() {
beforeUnmount() {
this.clearTimeout();
},
methods: {

View File

@ -50,7 +50,7 @@ export default {
updated() {
this.fixTwoCNChar();
},
beforeDestroy() {
beforeUnmount() {
if (this.delayTimeout) {
clearTimeout(this.delayTimeout);
}

View File

@ -108,7 +108,7 @@ const Carousel = {
// https://github.com/ant-design/ant-design/issues/7191
this.innerSlider = this.$refs.slick && this.$refs.slick.innerSlider;
},
beforeDestroy() {
beforeUnmount() {
const { autoplay } = this;
if (autoplay) {
window.removeEventListener('resize', this.onWindowResized);

View File

@ -53,7 +53,7 @@ export default {
'`value` is not validate prop, do you mean `checked`?',
);
},
beforeDestroy() {
beforeUnmount() {
const { value, checkboxGroupContext: checkboxGroup = {} } = this;
if (checkboxGroup.cancelValue) {
checkboxGroup.cancelValue(value);

View File

@ -194,7 +194,7 @@ const Descriptions = {
});
});
},
beforeDestroy() {
beforeUnmount() {
ResponsiveObserve.unsubscribe(this.token);
},
render() {

View File

@ -85,7 +85,7 @@ const Drawer = {
this.preVisible = this.visible;
});
},
beforeDestroy() {
beforeUnmount() {
// unmount drawer in child, clear push.
if (this.parentDrawer) {
this.parentDrawer.pull();

View File

@ -121,7 +121,7 @@ export default {
this.initialValue = cloneDeep(this.fieldValue);
}
},
beforeDestroy() {
beforeUnmount() {
const { removeField } = this.FormContext;
removeField && removeField(this);
},

View File

@ -106,7 +106,7 @@ export default {
this.collectContext();
}
},
beforeDestroy() {
beforeUnmount() {
this.collectFormItemContext(this.$vnode && this.$vnode.context, 'delete');
},
mounted() {

View File

@ -48,7 +48,7 @@ export default {
});
});
},
beforeDestroy() {
beforeUnmount() {
ResponsiveObserve.unsubscribe(this.token);
},
methods: {

View File

@ -82,7 +82,7 @@ export default {
this.clearPasswordValueAttribute();
});
},
beforeDestroy() {
beforeUnmount() {
if (this.removePasswordTimeout) {
clearTimeout(this.removePasswordTimeout);
}

View File

@ -31,7 +31,7 @@ const ResizableTextArea = {
mounted() {
this.resizeTextarea();
},
beforeDestroy() {
beforeUnmount() {
raf.cancel(this.nextFrameActionId);
raf.cancel(this.resizeFrameId);
},

View File

@ -145,7 +145,7 @@ export default {
});
},
beforeDestroy() {
beforeUnmount() {
if (this.mql) {
this.mql.removeListener(this.responsiveHandler);
}

View File

@ -65,7 +65,7 @@ const LocaleProvider = {
setMomentLocale(locale);
changeConfirmLocale(locale && locale.Modal);
},
beforeDestroy() {
beforeUnmount() {
changeConfirmLocale();
},
render() {

View File

@ -64,7 +64,7 @@ const Menu = {
updated() {
this.propsUpdating = false;
},
// beforeDestroy() {
// beforeUnmount() {
// raf.cancel(this.mountRafId);
// },
watch: {

View File

@ -24,7 +24,7 @@ export default {
this.timeoutId = setTimeout(() => this.$el.focus());
}
},
beforeDestroy() {
beforeUnmount() {
clearTimeout(this.timeoutId);
},
methods: {

View File

@ -66,7 +66,7 @@ export default {
this.updateSpinning();
});
},
beforeDestroy() {
beforeUnmount() {
this.cancelExistingSpin();
},
methods: {

View File

@ -28,7 +28,7 @@ export default {
this.syncTimer();
},
beforeDestroy() {
beforeUnmount() {
this.stopTimer();
},

View File

@ -18,7 +18,7 @@ export default {
this.subscribe();
},
beforeDestroy() {
beforeUnmount() {
if (this.unsubscribe) {
this.unsubscribe();
}

View File

@ -125,7 +125,7 @@ export default {
this.subscribe();
},
beforeDestroy() {
beforeUnmount() {
if (this.unsubscribe) {
this.unsubscribe();
}

View File

@ -25,7 +25,7 @@ export default function createBodyRow(Component = 'tr') {
this.subscribe();
},
beforeDestroy() {
beforeUnmount() {
if (this.unsubscribe) {
this.unsubscribe();
}

View File

@ -92,7 +92,7 @@ export default {
// }
// });
// },
beforeDestroy() {
beforeUnmount() {
clearTimeout(this.triggerScrollTimer);
// if (this.scrollEvent) {
// this.scrollEvent.remove();

View File

@ -46,7 +46,7 @@ const ListBody = {
});
},
beforeDestroy() {
beforeUnmount() {
raf.cancel(this.mountId);
raf.cancel(this.lazyId);
},

View File

@ -48,7 +48,7 @@ export default {
this.sFileList = val || [];
},
},
beforeDestroy() {
beforeUnmount() {
this.clearProgressTimer();
},
methods: {

View File

@ -94,7 +94,7 @@ export default {
this.prevProps = { ...this.$props, align: clonedeep(this.$props.align) };
});
},
beforeDestroy() {
beforeUnmount() {
this.stopMonitorWindowResize();
},
methods: {

View File

@ -80,7 +80,7 @@ const Picker = {
this.preSOpen = this.sOpen;
},
beforeDestroy() {
beforeUnmount() {
clearTimeout(this.focusTimeout);
},
methods: {

View File

@ -96,7 +96,7 @@ export default {
}
});
},
beforeDestroy() {
beforeUnmount() {
const { visible, getOpenCount } = this;
if ((visible || this.inTransition) && !getOpenCount()) {
this.switchScrollingEffect();

View File

@ -130,7 +130,7 @@ const Drawer = {
}
});
},
beforeDestroy() {
beforeUnmount() {
delete currentDrawer[this.drawerId];
delete this.isOpenChange;
if (this.container) {

View File

@ -174,7 +174,7 @@ export default {
this.updatedFunc();
});
},
beforeDestroy() {
beforeUnmount() {
this.stop();
},
methods: {

View File

@ -73,7 +73,7 @@ export default {
this.scrollHander = addEventListener(eventNode, 'scroll', this.lazyLoadHandler);
});
},
beforeDestroy() {
beforeUnmount() {
this._mounted = false;
if (this.lazyLoadHandler.cancel) {
this.lazyLoadHandler.cancel();

View File

@ -80,7 +80,7 @@ const DOMWrap = {
});
},
beforeDestroy() {
beforeUnmount() {
if (this.resizeObserver) {
this.resizeObserver.disconnect();
}

View File

@ -59,7 +59,7 @@ const MenuItem = {
});
this.callRef();
},
beforeDestroy() {
beforeUnmount() {
const props = this.$props;
this.__emit('destroy', props.eventKey);
},

View File

@ -102,7 +102,7 @@ const SubMenu = {
});
},
beforeDestroy() {
beforeUnmount() {
const { eventKey } = this;
this.__emit('destroy', eventKey);

View File

@ -28,9 +28,9 @@ export default {
}
},
beforeDestroy() {
beforeUnmount() {
this.clearCloseTimer();
this.willDestroy = true; // beforeDestroyonMouseleave
this.willDestroy = true; // beforeUnmountonMouseleave
},
methods: {
close(e) {

View File

@ -23,7 +23,7 @@ const VueResizeObserver = {
updated() {
this.onComponentUpdated();
},
beforeDestroy() {
beforeUnmount() {
this.destroyObserver();
},
methods: {

View File

@ -63,7 +63,7 @@ export default {
this.lastInputValue = props.inputValue;
this.prevVisible = this.visible;
},
beforeDestroy() {
beforeUnmount() {
if (this.rafInstance) {
raf.cancel(this.rafInstance);
}

View File

@ -200,7 +200,7 @@ const Select = {
this.forcePopupAlign();
});
},
beforeDestroy() {
beforeUnmount() {
this.clearFocusTime();
this.clearBlurTime();
this.clearComboboxTime();

View File

@ -82,7 +82,7 @@ export default {
this.setDropdownWidth();
});
},
beforeDestroy() {
beforeUnmount() {
this.cancelRafInstance();
},
methods: {

View File

@ -489,7 +489,7 @@ export default {
}
});
},
beforeDestroy() {
beforeUnmount() {
if (this.animationEndCallback) {
clearTimeout(this.animationEndCallback);
}

View File

@ -87,7 +87,7 @@ export default {
});
}
},
beforeDestroy() {
beforeUnmount() {
this._responsiveMediaHandlers.forEach(function(obj) {
enquire.unregister(obj.query, obj.handler);
});

View File

@ -31,7 +31,7 @@ export default {
// so we listen on document here.
this.onMouseUpListener = addEventListener(document, 'mouseup', this.handleMouseUp);
},
beforeDestroy() {
beforeUnmount() {
if (this.onMouseUpListener) {
this.onMouseUpListener.remove();
}

View File

@ -81,7 +81,7 @@ export default function createSlider(Component) {
}
});
},
beforeDestroy() {
beforeUnmount() {
this.$nextTick(() => {
// if (super.componentWillUnmount) super.componentWillUnmount()
this.removeDocumentEvents();

View File

@ -46,7 +46,7 @@ export default {
this.calcStepOffsetWidth();
});
},
beforeDestroy() {
beforeUnmount() {
if (this.calcTimeout) {
clearTimeout(this.calcTimeout);
}

View File

@ -25,7 +25,7 @@ const ExpandableRow = {
// children: PropTypes.func.isRequired,
},
beforeDestroy() {
beforeUnmount() {
this.handleDestroy();
},
methods: {

View File

@ -203,7 +203,7 @@ export default {
});
},
beforeDestroy() {
beforeUnmount() {
if (this.resizeEvent) {
this.resizeEvent.remove();
}

View File

@ -58,7 +58,7 @@ export default {
});
},
beforeDestroy() {
beforeUnmount() {
if (this.resizeObserver) {
this.resizeObserver.disconnect();
}

View File

@ -80,7 +80,7 @@ export default {
}
},
},
beforeDestroy() {
beforeUnmount() {
this.destroy = true;
raf.cancel(this.sentinelId);
},

View File

@ -78,7 +78,7 @@ const TreeNode = {
updated() {
this.syncLoadData(this.$props);
},
beforeDestroy() {
beforeUnmount() {
const {
eventKey,
vcTree: { registerTreeNode },

View File

@ -62,7 +62,7 @@ export default {
this.setStretchSize();
});
},
beforeDestroy() {
beforeUnmount() {
if (this.$el.parentNode) {
this.$el.parentNode.removeChild(this.$el);
} else if (this.$el.remove) {

View File

@ -125,7 +125,7 @@ export default {
});
},
beforeDestroy() {
beforeUnmount() {
this.clearDelayTimer();
this.clearOutsideHandler();
clearTimeout(this.mouseDownTimeout);

View File

@ -45,7 +45,7 @@ const AjaxUploader = {
mounted() {
this._isMounted = true;
},
beforeDestroy() {
beforeUnmount() {
this._isMounted = false;
this.abort();
},

View File

@ -1,3 +1,18 @@
<template>
<a-empty />
<div>
<a-button @click="show = !show">按钮</a-button>
<a-tooltip class="ddddd" style="color: blue" v-if="show">
<template v-slot:title>prompt text</template>
<a-button class="test" style="color: red">Tooltip will show when mouse enter.</a-button>
</a-tooltip>
</div>
</template>
<script>
export default {
data() {
return {
show: true,
};
},
};
</script>