pull/9/head
tangjinzhou 2018-02-02 17:42:05 +08:00
parent aa519f6014
commit 0c4c3100f6
5 changed files with 37 additions and 31 deletions

View File

@ -84,10 +84,14 @@ export default {
}, },
}, },
mounted () { mounted () {
this.setScale() this.$nextTick(() => {
this.setScale()
})
}, },
updated () { updated () {
this.setScale() this.$nextTick(() => {
this.setScale()
})
}, },
components: { components: {
Icon, Icon,

View File

@ -7,7 +7,6 @@ const props = buttonTypes()
export default { export default {
name: 'Button', name: 'Button',
__ANT_BUTTON: true, __ANT_BUTTON: true,
components: { Icon },
props: { props: {
...props, ...props,
}, },
@ -22,16 +21,13 @@ export default {
} }
}, },
watch: { watch: {
loading: { loading (val) {
handler: function (val) { clearTimeout(this.delayTimeout)
clearTimeout(this.delayTimeout) if (typeof val !== 'boolean' && val && val.delay) {
if (typeof val !== 'boolean' && val && val.delay) { this.delayTimeout = setTimeout(() => { this.sLoading = !!val }, val.delay)
this.delayTimeout = setTimeout(() => { this.sLoading = !!val }, val.delay) } else {
} else { this.sLoading = !!val
this.sLoading = !!val }
}
},
deep: true,
}, },
}, },
computed: { computed: {

View File

@ -1,3 +1,2 @@
@import "./themes/default"; @import "./themes/default";
@import "./core/index"; @import "./core/index";
@import "./vue-antd";

View File

@ -30,20 +30,24 @@ export default {
} }
}, },
mounted () { mounted () {
this._container = this.getContainer() this.$nextTick(() => {
this._container.appendChild(this.$el) this._container = this.getContainer()
this.initAlign = true this._container.appendChild(this.$el)
this.initAlign = true
})
}, },
beforeDestroy () { beforeDestroy () {
this.$el.remove() this.$el.remove()
}, },
beforeUpdate () { beforeUpdate () {
const newContainer = this.getContainer() this.$nextTick(() => {
if (newContainer !== this._container) { const newContainer = this.getContainer()
this._container = newContainer if (newContainer !== this._container) {
this._container.appendChild(this.$el) this._container = newContainer
this.$refs.alignInstance.forceAlign() this._container.appendChild(this.$el)
} this.$refs.alignInstance.forceAlign()
}
})
}, },
watch: { watch: {
visible (val) { visible (val) {

View File

@ -85,7 +85,9 @@ export default {
}, },
mounted () { mounted () {
this.updatedCal() this.$nextTick(() => {
this.updatedCal()
})
}, },
watch: { watch: {
popupVisible (val) { popupVisible (val) {
@ -101,7 +103,9 @@ export default {
}, },
updated () { updated () {
this.updatedCal() this.$nextTick(() => {
this.updatedCal()
})
}, },
beforeDestroy () { beforeDestroy () {
@ -116,7 +120,6 @@ export default {
updatedCal () { updatedCal () {
const props = this.$props const props = this.$props
const state = this.$data const state = this.$data
// this.renderComponent()
// We must listen to `mousedown` or `touchstart`, edge case: // We must listen to `mousedown` or `touchstart`, edge case:
// https://github.com/ant-design/ant-design/issues/5804 // https://github.com/ant-design/ant-design/issues/5804
@ -146,10 +149,9 @@ export default {
this.contextmenuOutsideHandler2 = addEventListener(window, this.contextmenuOutsideHandler2 = addEventListener(window,
'blur', this.onContextmenuClose) 'blur', this.onContextmenuClose)
} }
return } else {
this.clearOutsideHandler()
} }
this.clearOutsideHandler()
}, },
onMouseenter (e) { onMouseenter (e) {
this.fireEvents('mouseenter', e) this.fireEvents('mouseenter', e)
@ -167,6 +169,7 @@ export default {
onPopupMouseleave (e) { onPopupMouseleave (e) {
if (e.relatedTarget && !e.relatedTarget.setTimeout && if (e.relatedTarget && !e.relatedTarget.setTimeout &&
this._component &&
this._component.$refs.popup && this._component.$refs.popup &&
this._component.$refs.popup.getPopupDomNode && this._component.$refs.popup.getPopupDomNode &&
contains(this._component.$refs.popup.getPopupDomNode(), e.relatedTarget)) { contains(this._component.$refs.popup.getPopupDomNode(), e.relatedTarget)) {
@ -256,7 +259,7 @@ export default {
} }
}, },
getPopupDomNode () { 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 this._component.$refs.popup.getPopupDomNode()
} }
return null return null
@ -462,7 +465,7 @@ export default {
return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1 return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1
}, },
forcePopupAlign () { 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() this._component.$refs.popup.$refs.alignInstance.forceAlign()
} }
}, },