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 () {
this.setScale()
this.$nextTick(() => {
this.setScale()
})
},
updated () {
this.setScale()
this.$nextTick(() => {
this.setScale()
})
},
components: {
Icon,

View File

@ -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: {

View File

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

View File

@ -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) {

View File

@ -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()
}
},