diff --git a/components/avatar/Avatar.vue b/components/avatar/Avatar.vue index a22e9268e..5a8506528 100644 --- a/components/avatar/Avatar.vue +++ b/components/avatar/Avatar.vue @@ -84,10 +84,14 @@ export default { }, }, mounted () { - this.setScale() + this.$nextTick(() => { + this.setScale() + }) }, updated () { - this.setScale() + this.$nextTick(() => { + this.setScale() + }) }, components: { Icon, diff --git a/components/button/button.vue b/components/button/button.vue index b2be9f17d..344009fc4 100644 --- a/components/button/button.vue +++ b/components/button/button.vue @@ -7,7 +7,6 @@ const props = buttonTypes() export default { name: 'Button', __ANT_BUTTON: true, - components: { Icon }, props: { ...props, }, @@ -22,16 +21,13 @@ export default { } }, watch: { - loading: { - handler: function (val) { - clearTimeout(this.delayTimeout) - if (typeof val !== 'boolean' && val && val.delay) { - this.delayTimeout = setTimeout(() => { this.sLoading = !!val }, val.delay) - } else { - this.sLoading = !!val - } - }, - deep: true, + loading (val) { + clearTimeout(this.delayTimeout) + if (typeof val !== 'boolean' && val && val.delay) { + this.delayTimeout = setTimeout(() => { this.sLoading = !!val }, val.delay) + } else { + this.sLoading = !!val + } }, }, computed: { diff --git a/components/style/index.less b/components/style/index.less index 8d6f79b6b..a33fdfc3a 100644 --- a/components/style/index.less +++ b/components/style/index.less @@ -1,3 +1,2 @@ @import "./themes/default"; @import "./core/index"; -@import "./vue-antd"; diff --git a/components/trigger/Popup.vue b/components/trigger/Popup.vue index c65015bba..ee4207c75 100644 --- a/components/trigger/Popup.vue +++ b/components/trigger/Popup.vue @@ -30,20 +30,24 @@ export default { } }, mounted () { - this._container = this.getContainer() - this._container.appendChild(this.$el) - this.initAlign = true + this.$nextTick(() => { + this._container = this.getContainer() + this._container.appendChild(this.$el) + this.initAlign = true + }) }, beforeDestroy () { this.$el.remove() }, beforeUpdate () { - const newContainer = this.getContainer() - if (newContainer !== this._container) { - this._container = newContainer - this._container.appendChild(this.$el) - this.$refs.alignInstance.forceAlign() - } + this.$nextTick(() => { + const newContainer = this.getContainer() + if (newContainer !== this._container) { + this._container = newContainer + this._container.appendChild(this.$el) + this.$refs.alignInstance.forceAlign() + } + }) }, watch: { visible (val) { diff --git a/components/trigger/index.vue b/components/trigger/index.vue index 014e21501..9ca1c93ce 100644 --- a/components/trigger/index.vue +++ b/components/trigger/index.vue @@ -85,7 +85,9 @@ export default { }, mounted () { - this.updatedCal() + this.$nextTick(() => { + this.updatedCal() + }) }, watch: { popupVisible (val) { @@ -101,7 +103,9 @@ export default { }, updated () { - this.updatedCal() + this.$nextTick(() => { + this.updatedCal() + }) }, beforeDestroy () { @@ -116,7 +120,6 @@ export default { updatedCal () { const props = this.$props const state = this.$data - // this.renderComponent() // We must listen to `mousedown` or `touchstart`, edge case: // https://github.com/ant-design/ant-design/issues/5804 @@ -146,10 +149,9 @@ export default { this.contextmenuOutsideHandler2 = addEventListener(window, 'blur', this.onContextmenuClose) } - return + } else { + this.clearOutsideHandler() } - - this.clearOutsideHandler() }, onMouseenter (e) { this.fireEvents('mouseenter', e) @@ -167,6 +169,7 @@ export default { onPopupMouseleave (e) { if (e.relatedTarget && !e.relatedTarget.setTimeout && + this._component && this._component.$refs.popup && this._component.$refs.popup.getPopupDomNode && contains(this._component.$refs.popup.getPopupDomNode(), e.relatedTarget)) { @@ -256,7 +259,7 @@ export default { } }, getPopupDomNode () { - if (this._component.$refs.popup && this._component.$refs.popup.getPopupDomNode) { + if (this._component && this._component.$refs.popup && this._component.$refs.popup.getPopupDomNode) { return this._component.$refs.popup.getPopupDomNode() } return null @@ -462,7 +465,7 @@ export default { return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1 }, forcePopupAlign () { - if (this.$data.sPopupVisible && this._component.$refs.popup && this._component.$refs.popup.$refs.alignInstance) { + if (this.$data.sPopupVisible && this._component && this._component.$refs.popup && this._component.$refs.popup.$refs.alignInstance) { this._component.$refs.popup.$refs.alignInstance.forceAlign() } },