diff --git a/components/_util/props-util.js b/components/_util/props-util.js
index d98722fc2..68e8f97b2 100644
--- a/components/_util/props-util.js
+++ b/components/_util/props-util.js
@@ -18,5 +18,13 @@ const getOptionProps = (instance) => {
return filterProps($props, $options.propsData)
}
-export { hasProp, filterProps, getOptionProps }
+const getComponentFromProp = (instance, h, prop) => {
+ const temp = instance[prop]
+ if (temp !== undefined) {
+ return typeof temp === 'function' ? temp(h) : temp
+ }
+ return instance.$slots[prop]
+}
+
+export { hasProp, filterProps, getOptionProps, getComponentFromProp }
export default hasProp
diff --git a/components/button/button.vue b/components/button/button.vue
index 39b78a8d0..e82a87c07 100644
--- a/components/button/button.vue
+++ b/components/button/button.vue
@@ -2,40 +2,13 @@
import Icon from '../icon'
const rxTwoCNChar = /^[\u4e00-\u9fa5]{2}$/
const isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar)
+import buttonTypes from './buttonTypes'
export default {
name: 'Button',
__ANT_BUTTON: true,
components: { Icon },
props: {
- prefixCls: {
- default: 'ant-btn',
- type: String,
- },
- type: {
- validator (value) {
- return ['primary', 'danger', 'dashed', 'ghost', 'default'].includes(value)
- },
- },
- htmlType: {
- default: 'button',
- validator (value) {
- return ['button', 'submit', 'reset'].includes(value)
- },
- },
- icon: String,
- shape: {
- validator (value) {
- return ['circle', 'circle-outline'].includes(value)
- },
- },
- size: {
- validator (value) {
- return ['small', 'large', 'default'].includes(value)
- },
- },
- loading: [Boolean, Object],
- disabled: Boolean,
- ghost: Boolean,
+ ...buttonTypes,
},
data () {
return {
diff --git a/components/button/buttonTypes.js b/components/button/buttonTypes.js
new file mode 100644
index 000000000..2104f1aa7
--- /dev/null
+++ b/components/button/buttonTypes.js
@@ -0,0 +1,12 @@
+import PropTypes from '../_util/vue-types'
+export default {
+ prefixCls: PropTypes.string.def('ant-btn'),
+ type: PropTypes.oneOf(['primary', 'danger', 'dashed', 'ghost', 'default']).def('default'),
+ htmlType: PropTypes.oneOf(['button', 'submit', 'reset']).def('button'),
+ icon: PropTypes.string,
+ shape: PropTypes.oneOf(['circle', 'circle-outline']),
+ size: PropTypes.oneOf(['small', 'large', 'default']).def('default'),
+ loading: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
+ disabled: PropTypes.bool,
+ ghost: PropTypes.bool,
+}
diff --git a/components/index.js b/components/index.js
index 3b8f554d7..18db6ca7d 100644
--- a/components/index.js
+++ b/components/index.js
@@ -29,3 +29,5 @@ export { default as Tabs } from './tabs'
export { default as Input } from './input'
export { default as Popover } from './popover'
+
+export { default as Popconfirm } from './popconfirm'
diff --git a/components/popconfirm/demo/basic.vue b/components/popconfirm/demo/basic.vue
new file mode 100644
index 000000000..95f6bbb29
--- /dev/null
+++ b/components/popconfirm/demo/basic.vue
@@ -0,0 +1,29 @@
+
+