diff --git a/components/align/Align.vue b/components/align/Align.vue index 9ca83a79e..52204ae90 100644 --- a/components/align/Align.vue +++ b/components/align/Align.vue @@ -4,7 +4,6 @@ import align from 'dom-align' import addEventListener from '../_util/Dom/addEventListener' import { cloneElement } from '../_util/vnode.js' import isWindow from './isWindow' -import isEqual from 'lodash.isequal' function noop () { } @@ -44,42 +43,46 @@ export default { } }, mounted () { - this.prevProps = { ...this.$props } - const props = this.$props - // if parent ref not attached .... use document.getElementById - !this.aligned && this.forceAlign() - if (!props.disabled && props.monitorWindowResize) { - this.startMonitorWindowResize() - } + this.$nextTick(() => { + this.prevProps = { ...this.$props } + const props = this.$props + // if parent ref not attached .... use document.getElementById + !this.aligned && this.forceAlign() + if (!props.disabled && props.monitorWindowResize) { + this.startMonitorWindowResize() + } + }) }, updated () { - const prevProps = this.prevProps - const props = this.$props - let reAlign = false - if (!props.disabled && this.visible) { - if (prevProps.disabled || prevProps.align !== props.align) { - reAlign = true - } else { - const lastTarget = prevProps.target() - const currentTarget = props.target() - if (isWindow(lastTarget) && isWindow(currentTarget)) { - reAlign = false - } else if (lastTarget !== currentTarget) { + this.$nextTick(() => { + const prevProps = this.prevProps + const props = this.$props + let reAlign = false + if (!props.disabled && this.visible) { + if (prevProps.disabled || prevProps.align !== props.align) { reAlign = true + } else { + const lastTarget = prevProps.target() + const currentTarget = props.target() + if (isWindow(lastTarget) && isWindow(currentTarget)) { + reAlign = false + } else if (lastTarget !== currentTarget) { + reAlign = true + } } } - } - if (reAlign) { - this.forceAlign() - } + if (reAlign) { + this.forceAlign() + } - if (props.monitorWindowResize && !props.disabled) { - this.startMonitorWindowResize() - } else { - this.stopMonitorWindowResize() - } - this.prevProps = { ...this.$props } + if (props.monitorWindowResize && !props.disabled) { + this.startMonitorWindowResize() + } else { + this.stopMonitorWindowResize() + } + this.prevProps = { ...this.$props } + }) }, beforeDestroy () { this.stopMonitorWindowResize() diff --git a/components/button/demo/index.vue b/components/button/demo/index.vue index 93513ba47..a0b231d4c 100644 --- a/components/button/demo/index.vue +++ b/components/button/demo/index.vue @@ -32,7 +32,6 @@ export default { -

TODO : Multiple

diff --git a/components/button/demo/multiple.md b/components/button/demo/multiple.md index da4045e54..48681ee5e 100644 --- a/components/button/demo/multiple.md +++ b/components/button/demo/multiple.md @@ -9,13 +9,29 @@ If you need several buttons, we recommend that you use 1 primary button + n seco ```html -// TODO: 依赖组件开发中 + ``` diff --git a/components/index.js b/components/index.js index 61d21988d..c57657215 100644 --- a/components/index.js +++ b/components/index.js @@ -78,3 +78,5 @@ export { Select, SelectOption, SelectOptGroup } export { default as Switch } from './switch' +export { default as LocaleProvider } from './locale-provider' + diff --git a/components/input/Input.vue b/components/input/Input.vue index 8d4e9f494..f8596244f 100644 --- a/components/input/Input.vue +++ b/components/input/Input.vue @@ -2,7 +2,7 @@ import TextArea from './TextArea' import omit from 'omit.js' import inputProps from './inputProps' -import hasProp from '../_util/props-util' +import { hasProp, getComponentFromProp } from '../_util/props-util' function fixControlledValue (value) { if (typeof value === 'undefined' || value === null) { @@ -68,8 +68,9 @@ export default { } }, renderLabeledInput (children) { - const props = this.props - let { addonBefore, addonAfter } = this.$slots + const props = this.$props + let addonAfter = getComponentFromProp(this, 'addonAfter') + let addonBefore = getComponentFromProp(this, 'addonBefore') // Not wrap when there is not addons if ((!addonBefore && !addonAfter)) { return children @@ -117,7 +118,8 @@ export default { }, renderLabeledIcon (children) { const { prefixCls } = this.$props - let { prefix, suffix } = this.$slots + let prefix = getComponentFromProp(this, 'prefix') + let suffix = getComponentFromProp(this, 'suffix') if (!prefix && !suffix) { return children } diff --git a/components/input/demo/addon.vue b/components/input/demo/addon.vue new file mode 100644 index 000000000..d26edd1e3 --- /dev/null +++ b/components/input/demo/addon.vue @@ -0,0 +1,31 @@ + + diff --git a/components/input/demo/index.vue b/components/input/demo/index.vue index e8deb705c..0f1782690 100644 --- a/components/input/demo/index.vue +++ b/components/input/demo/index.vue @@ -12,6 +12,8 @@

TextArea