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: 依赖组件开发中
Primary
-
Default
-
Dashed
-
Danger
+
secondary
+
+
+ 1st item
+ 2nd item
+ 3rd item
+
+
+ Actions
+
+
+
```
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 @@
+
+
+
+
+
+
+ Http://
+ Https://
+
+
+ .com
+ .jp
+ .cn
+ .org
+
+
+
+
+
+
+
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
+ Addon
+
diff --git a/components/input/inputProps.js b/components/input/inputProps.js
index c35279cd3..e3855df86 100644
--- a/components/input/inputProps.js
+++ b/components/input/inputProps.js
@@ -1,3 +1,4 @@
+import PropTypes from '../_util/vue-types'
export default {
prefixCls: {
default: 'ant-input',
@@ -22,17 +23,16 @@ export default {
type: Boolean,
},
readOnly: Boolean,
- // addonBefore: React.ReactNode,
- // addonAfter: React.ReactNode,
+ addonBefore: PropTypes.any,
+ addonAfter: PropTypes.any,
// onPressEnter?: React.FormEventHandler;
// onKeyDown?: React.FormEventHandler;
// onChange?: React.ChangeEventHandler;
// onClick?: React.FormEventHandler;
// onFocus?: React.FormEventHandler;
// onBlur?: React.FormEventHandler;
- // autoComplete: String;
- // prefix: React.ReactNode,
- // suffix: React.ReactNode,
+ prefix: PropTypes.any,
+ suffix: PropTypes.any,
spellCheck: Boolean,
autoFocus: Boolean,
}
diff --git a/components/locale-provider/index.vue b/components/locale-provider/index.vue
index a6e837507..17ee12cb4 100644
--- a/components/locale-provider/index.vue
+++ b/components/locale-provider/index.vue
@@ -56,7 +56,7 @@ export default {
// changeConfirmLocale()
},
render () {
- return this.$slots.default
+ return this.$slots.default[0]
},
}
diff --git a/components/locale-provider/zh_CN.js b/components/locale-provider/zh_CN.js
new file mode 100644
index 000000000..4fb6613c5
--- /dev/null
+++ b/components/locale-provider/zh_CN.js
@@ -0,0 +1,44 @@
+// import Pagination from 'rc-pagination/lib/locale/zh_CN'
+// import DatePicker from '../date-picker/locale/zh_CN'
+// import TimePicker from '../time-picker/locale/zh_CN'
+// import Calendar from '../calendar/locale/zh_CN'
+
+export default {
+ locale: 'zh-cn',
+ // Pagination,
+ // DatePicker,
+ // TimePicker,
+ // Calendar,
+ Table: {
+ filterTitle: '筛选',
+ filterConfirm: '确定',
+ filterReset: '重置',
+ emptyText: '暂无数据',
+ selectAll: '全选当页',
+ selectInvert: '反选当页',
+ },
+ Modal: {
+ okText: '确定',
+ cancelText: '取消',
+ justOkText: '知道了',
+ },
+ Popconfirm: {
+ cancelText: '取消',
+ okText: '确定',
+ },
+ Transfer: {
+ notFoundContent: '无匹配结果',
+ searchPlaceholder: '请输入搜索内容',
+ itemUnit: '项',
+ itemsUnit: '项',
+ },
+ Select: {
+ notFoundContent: '无匹配结果',
+ },
+ Upload: {
+ uploading: '文件上传中',
+ removeFile: '删除文件',
+ uploadError: '上传错误',
+ previewFile: '预览文件',
+ },
+}
diff --git a/components/trigger/Popup.vue b/components/trigger/Popup.vue
index 465e0655f..38e1b7ac1 100644
--- a/components/trigger/Popup.vue
+++ b/components/trigger/Popup.vue
@@ -27,14 +27,8 @@ export default {
data () {
return {
destroyPopup: false,
- initAlign: false, // mounted之后再实例化align,即改变this.$el位置后实例化,避免位置计算不正确
}
},
- mounted () {
- this.$nextTick(() => {
- this.initAlign = true
- })
- },
beforeDestroy () {
this.$el.remove()
},
@@ -128,13 +122,15 @@ export default {
let useTransition = !!transitionName
const transitionEvent = {
beforeEnter: (el) => {
- el.style.display = el.__vOriginalDisplay
+ // el.style.display = el.__vOriginalDisplay
// this.$refs.alignInstance.forceAlign()
},
enter: (el, done) => {
// align updated后执行动画
this.$nextTick(() => {
- animate(el, `${transitionName}-enter`, done)
+ this.$refs.alignInstance.$nextTick(() => {
+ animate(el, `${transitionName}-enter`, done)
+ })
})
},
leave: (el, done) => {
@@ -194,7 +190,7 @@ export default {
getMaskElement () {
const props = this.$props
- let maskElement
+ let maskElement = null
if (props.mask) {
const maskTransition = this.getMaskTransitionName()
maskElement = (
@@ -222,15 +218,11 @@ export default {
},
render () {
- const { destroyPopup, getMaskElement, getPopupElement, initAlign } = this
+ const { destroyPopup, getMaskElement, getPopupElement } = this
return (
- {initAlign ? (
- getMaskElement(),
- destroyPopup
- ? null : getPopupElement()
- ) : null }
-
+ {getMaskElement()}
+ { destroyPopup ? null : getPopupElement()}
)
},
diff --git a/components/trigger/index.vue b/components/trigger/index.vue
index c9e43d879..f94a048a2 100644
--- a/components/trigger/index.vue
+++ b/components/trigger/index.vue
@@ -338,6 +338,7 @@ export default {
popupProps: { ...popupProps },
}
},
+ parent: self,
el: div,
render () {
const { popupEvents, ...otherProps } = this.popupProps
diff --git a/examples/components/demo.vue b/examples/components/demo.vue
index f52f79b67..9e4a58287 100644
--- a/examples/components/demo.vue
+++ b/examples/components/demo.vue
@@ -1,29 +1,34 @@