pull/165/head
wangxueliang 2018-04-09 17:01:50 +08:00
commit 1e4d422e6b
89 changed files with 342 additions and 234 deletions

View File

@ -57,7 +57,7 @@ const AffixProps = {
} }
export default { export default {
name: 'Affix', name: 'AAffix',
props: AffixProps, props: AffixProps,
mixins: [BaseMixin], mixins: [BaseMixin],
data () { data () {

View File

@ -33,7 +33,7 @@ export const AlertProps = {
export default { export default {
props: AlertProps, props: AlertProps,
mixins: [BaseMixin], mixins: [BaseMixin],
name: 'Alert', name: 'AAlert',
data () { data () {
return { return {
closing: true, closing: true,

View File

@ -32,6 +32,7 @@ const AutoCompleteProps = {
} }
export default { export default {
name: 'AAutoComplete',
props: { props: {
...AutoCompleteProps, ...AutoCompleteProps,
prefixCls: PropTypes.string.def('ant-select'), prefixCls: PropTypes.string.def('ant-select'),
@ -45,8 +46,8 @@ export default {
]).def(false), ]).def(false),
defaultActiveFirstOption: PropTypes.bool.def(true), defaultActiveFirstOption: PropTypes.bool.def(true),
}, },
Option, Option: { ...Option, name: 'AAutoCompleteOption' },
OptGroup, OptGroup: { ...OptGroup, name: 'AAutoCompleteOptGroup' },
model: { model: {
prop: 'value', prop: 'value',
event: 'change', event: 'change',

View File

@ -2,7 +2,7 @@
import Icon from '../icon' import Icon from '../icon'
export default { export default {
name: 'Avatar', name: 'AAvatar',
props: { props: {
prefixCls: { prefixCls: {
type: String, type: String,

View File

@ -30,7 +30,7 @@ const BackTopProps = {
} }
export default { export default {
name: 'BackTop', name: 'ABackTop',
mixins: [BaseMixin], mixins: [BaseMixin],
props: { props: {
...BackTopProps, ...BackTopProps,

View File

@ -22,6 +22,7 @@ export const BadgeProps = {
} }
export default { export default {
name: 'ABadge',
props: initDefaultProps(BadgeProps, { props: initDefaultProps(BadgeProps, {
prefixCls: 'ant-badge', prefixCls: 'ant-badge',
scrollNumberPrefixCls: 'ant-scroll-number', scrollNumberPrefixCls: 'ant-scroll-number',

View File

@ -31,6 +31,7 @@ function getBreadcrumbName (route, params) {
} }
export default { export default {
name: 'ABreadcrumb',
props: BreadcrumbProps, props: BreadcrumbProps,
methods: { methods: {
defaultItemRender ({ route, params, routes, paths }) { defaultItemRender ({ route, params, routes, paths }) {

View File

@ -3,7 +3,7 @@ import PropTypes from '../_util/vue-types'
import { hasProp, getComponentFromProp } from '../_util/props-util' import { hasProp, getComponentFromProp } from '../_util/props-util'
export default { export default {
name: 'BreadcrumbItem', name: 'ABreadcrumbItem',
__ANT_BREADCRUMB_ITEM: true, __ANT_BREADCRUMB_ITEM: true,
props: { props: {
prefixCls: PropTypes.string.def('ant-breadcrumb'), prefixCls: PropTypes.string.def('ant-breadcrumb'),

View File

@ -13,7 +13,7 @@ const ButtonGroupProps = {
} }
export { ButtonGroupProps } export { ButtonGroupProps }
export default { export default {
name: 'ButtonGroup', name: 'AButtonGroup',
props: ButtonGroupProps, props: ButtonGroupProps,
data () { data () {
return { return {

View File

@ -5,7 +5,7 @@ const isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar)
import buttonTypes from './buttonTypes' import buttonTypes from './buttonTypes'
const props = buttonTypes() const props = buttonTypes()
export default { export default {
name: 'Button', name: 'AButton',
__ANT_BUTTON: true, __ANT_BUTTON: true,
props: { props: {
...props, ...props,

View File

@ -49,6 +49,7 @@ export const CalendarProps = () => ({
}) })
export default { export default {
name: 'ACalendar',
mixins: [BaseMixin], mixins: [BaseMixin],
props: initDefaultProps(CalendarProps(), { props: initDefaultProps(CalendarProps(), {
locale: {}, locale: {},

View File

@ -8,7 +8,7 @@ import BaseMixin from '../_util/BaseMixin'
const { TabPane } = Tabs const { TabPane } = Tabs
export default { export default {
name: 'Card', name: 'ACard',
mixins: [BaseMixin], mixins: [BaseMixin],
props: { props: {
prefixCls: PropTypes.string.def('ant-card'), prefixCls: PropTypes.string.def('ant-card'),

View File

@ -2,7 +2,7 @@
import PropTypes from '../_util/vue-types' import PropTypes from '../_util/vue-types'
export default { export default {
name: 'Grid', name: 'ACardGrid',
props: { props: {
prefixCls: PropTypes.string.def('ant-card'), prefixCls: PropTypes.string.def('ant-card'),
}, },

View File

@ -3,7 +3,7 @@ import PropTypes from '../_util/vue-types'
import { getComponentFromProp } from '../_util/props-util' import { getComponentFromProp } from '../_util/props-util'
export default { export default {
name: 'Meta', name: 'ACardMeta',
props: { props: {
prefixCls: PropTypes.string.def('ant-card'), prefixCls: PropTypes.string.def('ant-card'),
title: PropTypes.string, title: PropTypes.string,

View File

@ -83,6 +83,7 @@ function defaultSortFilteredOption (a, b, inputValue) {
const defaultDisplayRender = ({ labels }) => labels.join(' / ') const defaultDisplayRender = ({ labels }) => labels.join(' / ')
export default { export default {
name: 'ACascader',
mixins: [BaseMixin], mixins: [BaseMixin],
props: CascaderProps, props: CascaderProps,
model: { model: {

View File

@ -1,7 +1,7 @@
import hasProp from '../_util/props-util' import hasProp from '../_util/props-util'
export default { export default {
name: 'Checkbox', name: 'ACheckbox',
props: { props: {
prefixCls: { prefixCls: {
default: 'ant-checkbox', default: 'ant-checkbox',

View File

@ -2,7 +2,7 @@
import Checkbox from './Checkbox' import Checkbox from './Checkbox'
import hasProp from '../_util/props-util' import hasProp from '../_util/props-util'
export default { export default {
name: 'CheckboxGroup', name: 'ACheckboxGroup',
props: { props: {
prefixCls: { prefixCls: {
default: 'ant-checkbox-group', default: 'ant-checkbox-group',

3
components/col/index.js Normal file
View File

@ -0,0 +1,3 @@
import { Col } from '../grid'
export default Col

View File

@ -0,0 +1,2 @@
import '../../style/index.less'
import '../../grid/style/index.less'

View File

@ -6,6 +6,7 @@ import RcCollapse from './src'
import { collapseProps } from './src/commonProps' import { collapseProps } from './src/commonProps'
export default { export default {
name: 'ACollapse',
model: { model: {
prop: 'activeKey', prop: 'activeKey',
event: 'change', event: 'change',

View File

@ -5,6 +5,7 @@ import RcCollapse from './src'
import { panelProps } from './src/commonProps' import { panelProps } from './src/commonProps'
export default { export default {
name: 'ACollapsePanel',
props: { props: {
name: PropTypes.string, name: PropTypes.string,
...panelProps, ...panelProps,

View File

@ -57,7 +57,7 @@ function fixLocale (value, localeCode) {
export default { export default {
mixins: [BaseMixin], mixins: [BaseMixin],
name: 'RangePicker', name: 'ARangePicker',
props: initDefaultProps(RangePickerProps(), { props: initDefaultProps(RangePickerProps(), {
prefixCls: 'ant-calendar', prefixCls: 'ant-calendar',
allowClear: true, allowClear: true,

View File

@ -24,7 +24,7 @@ export default {
format: 'gggg-wo', format: 'gggg-wo',
allowClear: true, allowClear: true,
}), }),
name: 'WeekPicker', name: 'AWeekPicker',
mixins: [BaseMixin], mixins: [BaseMixin],
data () { data () {
const value = this.value || this.defaultValue const value = this.value || this.defaultValue

View File

@ -6,9 +6,9 @@ import RangePicker from './RangePicker'
import WeekPicker from './WeekPicker' import WeekPicker from './WeekPicker'
import { DatePickerProps, MonthPickerProps, WeekPickerProps, RangePickerProps } from './interface' import { DatePickerProps, MonthPickerProps, WeekPickerProps, RangePickerProps } from './interface'
const DatePicker = wrapPicker(createPicker(VcCalendar, DatePickerProps()), DatePickerProps()) const DatePicker = wrapPicker({ ...createPicker(VcCalendar, DatePickerProps()), name: 'ADatePicker' }, DatePickerProps())
const MonthPicker = wrapPicker(createPicker(MonthCalendar, MonthPickerProps()), MonthPickerProps(), 'YYYY-MM') const MonthPicker = wrapPicker({ ...createPicker(MonthCalendar, MonthPickerProps()), name: 'AMonthPicker' }, MonthPickerProps(), 'YYYY-MM')
Object.assign(DatePicker, { Object.assign(DatePicker, {
RangePicker: wrapPicker(RangePicker, RangePickerProps()), RangePicker: wrapPicker(RangePicker, RangePickerProps()),

View File

@ -25,6 +25,7 @@ function getColumns ({ showHour, showMinute, showSecond, use12Hours }) {
export default function wrapPicker (Picker, props, defaultFormat) { export default function wrapPicker (Picker, props, defaultFormat) {
return { return {
name: Picker.name,
props: initDefaultProps(props, { props: initDefaultProps(props, {
format: defaultFormat || 'YYYY-MM-DD', format: defaultFormat || 'YYYY-MM-DD',
transitionName: 'slide-up', transitionName: 'slide-up',

View File

@ -1,6 +1,7 @@
import PropTypes from '../_util/vue-types' import PropTypes from '../_util/vue-types'
export default { export default {
name: 'ADivider',
props: { props: {
prefixCls: PropTypes.string.def('ant'), prefixCls: PropTypes.string.def('ant'),
type: PropTypes.oneOf(['horizontal', 'vertical']).def('horizontal'), type: PropTypes.oneOf(['horizontal', 'vertical']).def('horizontal'),

View File

@ -18,6 +18,7 @@ const DropdownButtonProps = {
} }
export { DropdownButtonProps } export { DropdownButtonProps }
export default { export default {
name: 'ADropdownButton',
props: DropdownButtonProps, props: DropdownButtonProps,
methods: { methods: {
onClick (e) { onClick (e) {

View File

@ -8,6 +8,7 @@ import { getOptionProps, getPropsData } from '../_util/props-util'
import getDropdownProps from './getDropdownProps' import getDropdownProps from './getDropdownProps'
const DropdownProps = getDropdownProps() const DropdownProps = getDropdownProps()
const Dropdown = { const Dropdown = {
name: 'ADropdown',
props: { props: {
...DropdownProps, ...DropdownProps,
prefixCls: PropTypes.string.def('ant-dropdown'), prefixCls: PropTypes.string.def('ant-dropdown'),

View File

@ -30,7 +30,7 @@ export const ColProps = {
export default { export default {
props: ColProps, props: ColProps,
name: 'Col', name: 'ACol',
render () { render () {
const { span, order, offset, push, pull, prefixCls = 'ant-col', $slots, $attrs, $listeners } = this const { span, order, offset, push, pull, prefixCls = 'ant-col', $slots, $attrs, $listeners } = this
let sizeClassObj = {}; let sizeClassObj = {};

View File

@ -50,7 +50,7 @@ const responsiveMap = {
} }
export default { export default {
name: 'Row', name: 'ARow',
mixins: [BaseMixin], mixins: [BaseMixin],
props: { props: {
...RowProps, ...RowProps,

View File

@ -1,6 +1,6 @@
export default { export default {
name: 'Icon', name: 'AIcon',
props: { props: {
prefixCls: { prefixCls: {
default: 'anticon', default: 'anticon',

View File

@ -2,7 +2,6 @@
// this file is not used if use https://github.com/ant-design/babel-plugin-import // this file is not used if use https://github.com/ant-design/babel-plugin-import
const ENV = process.env.NODE_ENV const ENV = process.env.NODE_ENV
if (ENV !== 'production' && if (ENV !== 'production' &&
ENV !== 'test' &&
typeof console !== 'undefined' && typeof console !== 'undefined' &&
console.warn && console.warn &&
typeof window !== 'undefined') { typeof window !== 'undefined') {
@ -13,143 +12,110 @@ if (ENV !== 'production' &&
} }
/* @remove-on-es-build-end */ /* @remove-on-es-build-end */
import Button from './button' export { default as Affix } from './affix'
const ButtonGroup = Button.Group
export { Button, ButtonGroup }
import Checkbox from './checkbox' // export { default as Anchor } from './anchor'
const CheckboxGroup = Checkbox.Group
export { Checkbox, CheckboxGroup }
export { default as Icon } from './icon'
import Radio from './radio'
const RadioGroup = Radio.Group
const RadioButton = Radio.Button
export { Radio, RadioGroup, RadioButton }
import { Row, Col } from './grid'
export {
Row,
Col,
}
export { default as Rate } from './rate'
export { default as Tooltip } from './tooltip'
export { default as Pagination } from './pagination'
import Tag from './tag'
const CheckableTag = Tag.CheckableTag
export {
Tag,
CheckableTag,
}
export { default as Avatar } from './avatar'
export { default as Badge } from './badge'
import Tabs from './tabs'
const TabPane = Tabs.TabPane
export {
Tabs,
TabPane,
}
import Input from './input'
const InputGroup = Input.Group
const InputSearch = Input.Search
const InputTextArea = Input.TextArea
const Textarea = InputTextArea
const TextArea = InputTextArea
export { Input, InputGroup, InputSearch, InputTextArea, Textarea, TextArea }
import Breadcrumb from './breadcrumb'
const BreadcrumbItem = Breadcrumb.Item
export { Breadcrumb, BreadcrumbItem }
export { default as Popover } from './popover'
export { default as Popconfirm } from './popconfirm'
import Menu from './menu'
const MenuItem = Menu.Item
const SubMenu = Menu.SubMenu
const MenuDivider = Menu.Divider
const MenuItemGroup = Menu.ItemGroup
export { Menu, MenuItem, SubMenu, MenuDivider, MenuItemGroup }
import Card from './card'
const CardMeta = Card.Meta
const CardGrid = Card.Grid
export { Card, CardMeta, CardGrid }
import Dropdown from './dropdown'
const DropdownButton = Dropdown.Button
export { Dropdown, DropdownButton }
export { default as Divider } from './divider'
import Collapse from './collapse'
const CollapsePanel = Collapse.Panel
export { Collapse, CollapsePanel }
import notification from './notification'
import message from './message'
export { default as Spin } from './spin'
import Select from './select'
const SelectOption = Select.Option
const SelectOptGroup = Select.OptGroup
export { Select, SelectOption, SelectOptGroup }
export { default as Switch } from './switch'
export { default as LocaleProvider } from './locale-provider'
export { default as AutoComplete } from './auto-complete' export { default as AutoComplete } from './auto-complete'
export { default as Affix } from './affix'
export { default as Cascader } from './cascader'
export { default as BackTop } from './back-top'
export { default as Modal } from './modal'
export { default as Alert } from './alert' export { default as Alert } from './alert'
export { default as TimePicker } from './time-picker'
export { notification, message } export { default as Avatar } from './avatar'
import Steps from './steps' export { default as BackTop } from './back-top'
const { Step } = Steps
export { Steps, Step } export { default as Badge } from './badge'
export { default as Breadcrumb } from './breadcrumb'
export { default as Button } from './button'
export { default as Calendar } from './calendar' export { default as Calendar } from './calendar'
import DatePicker from './date-picker' export { default as Card } from './card'
const { MonthPicker, RangePicker, WeekPicker } = DatePicker
export { DatePicker, MonthPicker, RangePicker, WeekPicker }
import Table from './table' export { default as Collapse } from './collapse'
const { Column: TableColumn, ColumnGroup: TableColumnGroup } = Table
export { Table, TableColumn, TableColumnGroup } // export { default as Carousel } from './carousel'
export { default as version } from './version' export { default as Cascader } from './cascader'
export { default as Slider } from './slider' export { default as Checkbox } from './checkbox'
export { default as Progress } from './progress' export { default as Col } from './col'
import Timeline from './timeline' export { default as DatePicker } from './date-picker'
const TimelineItem = Timeline.Item
export { Timeline, TimelineItem } export { default as Divider } from './divider'
export { default as Dropdown } from './dropdown'
// export { default as Form } from './form'
export { default as Icon } from './icon'
export { default as Input } from './input'
export { default as InputNumber } from './input-number' export { default as InputNumber } from './input-number'
// export { default as Layout } from './layout'
// export { default as List } from './list'
export { default as LocaleProvider } from './locale-provider'
export { default as message } from './message'
export { default as Menu } from './menu'
export { default as Modal } from './modal'
export { default as notification } from './notification'
export { default as Pagination } from './pagination'
export { default as Popconfirm } from './popconfirm'
export { default as Popover } from './popover'
export { default as Progress } from './progress'
export { default as Radio } from './radio'
export { default as Rate } from './rate'
export { default as Row } from './row'
export { default as Select } from './select'
export { default as Slider } from './slider'
export { default as Spin } from './spin'
export { default as Steps } from './steps'
export { default as Switch } from './switch'
export { default as Table } from './table'
export { default as Transfer } from './transfer' export { default as Transfer } from './transfer'
// export { default as Tree } from './tree'
// export { default as TreeSelect } from './tree-select'
export { default as Tabs } from './tabs'
export { default as Tag } from './tag'
export { default as TimePicker } from './time-picker'
export { default as Timeline } from './timeline'
export { default as Tooltip } from './tooltip'
// export { default as Mention } from './mention'
// export { default as Upload } from './upload'
export { default as version } from './version'

View File

@ -25,7 +25,7 @@ export const InputNumberProps = {
} }
export default { export default {
name: 'InputNumber', name: 'AInputNumber',
model: { model: {
prop: 'value', prop: 'value',
event: 'change', event: 'change',

View File

@ -1,6 +1,6 @@
import { filterEmpty } from '../_util/props-util' import { filterEmpty } from '../_util/props-util'
export default { export default {
name: 'InputGruop', name: 'AInputGroup',
props: { props: {
prefixCls: { prefixCls: {
default: 'ant-input-group', default: 'ant-input-group',

View File

@ -12,7 +12,7 @@ function fixControlledValue (value) {
} }
export default { export default {
name: 'Input', name: 'AInput',
props: { props: {
...inputProps, ...inputProps,
}, },

View File

@ -9,7 +9,7 @@ import { getOptionProps, getComponentFromProp } from '../_util/props-util'
import PropTypes from '../_util/vue-types' import PropTypes from '../_util/vue-types'
export default { export default {
name: 'InputSearch', name: 'AInputSearch',
props: { props: {
...inputProps, ...inputProps,
prefixCls: { prefixCls: {

View File

@ -26,7 +26,7 @@ function fixControlledValue (value) {
} }
export default { export default {
name: 'TextArea', name: 'ATextarea',
props: { props: {
...inputProps, ...inputProps,
autosize: [Object, Boolean], autosize: [Object, Boolean],

View File

@ -27,7 +27,7 @@ function setMomentLocale (locale) {
} }
export default { export default {
name: 'LocaleProvider', name: 'ALocaleProvider',
props: { props: {
locale: PropTypes.object.def({}), locale: PropTypes.object.def({}),
}, },

View File

@ -30,12 +30,12 @@ export const menuProps = {
} }
export default { export default {
name: 'Menu', name: 'AMenu',
props: menuProps, props: menuProps,
Divider, Divider: { ...Divider, name: 'AMenuDivider' },
Item, Item: { ...Item, name: 'AMenuItem' },
SubMenu, SubMenu: { ...SubMenu, name: 'ASubMenu' },
ItemGroup, ItemGroup: { ...ItemGroup, name: 'AMenuItemGroup' },
provide () { provide () {
return { return {
inlineCollapsed: this.getInlineCollapsed(), inlineCollapsed: this.getInlineCollapsed(),

View File

@ -14,11 +14,10 @@ Customize message display duration from default `3s` to `10s`.
<a-button @click="success">Customized display duration</a-button> <a-button @click="success">Customized display duration</a-button>
</template> </template>
<script> <script>
import { message } from 'antd'
export default { export default {
methods: { methods: {
success () { success () {
message.success('This is a prompt message for success, and it will disappear in 10 seconds', 10); this.$message.success('This is a prompt message for success, and it will disappear in 10 seconds', 10);
}, },
} }
} }

View File

@ -14,11 +14,10 @@ Normal messages as feedbacks.
<a-button type="primary" @click="info">Display normal message</a-button> <a-button type="primary" @click="info">Display normal message</a-button>
</template> </template>
<script> <script>
import { message } from 'antd'
export default { export default {
methods: { methods: {
info () { info () {
message.info('This is a normal message'); this.$message.info('This is a normal message');
}, },
} }
} }

View File

@ -14,11 +14,10 @@ Display a global loading indicator, which is dismissed by itself asynchronously.
<a-button @click="success">Display a loading indicator</a-button> <a-button @click="success">Display a loading indicator</a-button>
</template> </template>
<script> <script>
import { message } from 'antd'
export default { export default {
methods: { methods: {
success () { success () {
const hide = message.loading('Action in progress..', 0); const hide = this.$message.loading('Action in progress..', 0);
setTimeout(hide, 2500); setTimeout(hide, 2500);
}, },
} }

View File

@ -18,17 +18,16 @@ Messages of success, error and warning types.
</div> </div>
</template> </template>
<script> <script>
import { message } from 'antd'
export default { export default {
methods: { methods: {
success () { success () {
message.success('This is a message of success'); this.$message.success('This is a message of success');
}, },
error () { error () {
message.error('This is a message of error'); this.$message.error('This is a message of error');
}, },
warning () { warning () {
message.warning('This is message of warning'); this.$message.warning('This is message of warning');
}, },
} }
} }

View File

@ -55,6 +55,7 @@ const modalProps = (defaultProps = {}) => {
} }
export default { export default {
name: 'AModal',
props: modalProps({ props: modalProps({
prefixCls: 'ant-modal', prefixCls: 'ant-modal',
width: 520, width: 520,

View File

@ -17,12 +17,10 @@ delay closing the dialog.
</a-button> </a-button>
</template> </template>
<script> <script>
import { Modal } from 'antd'
const confirm = Modal.confirm
export default { export default {
methods: { methods: {
showConfirm() { showConfirm() {
confirm({ this.$confirm({
title: 'Do you want to delete these items?', title: 'Do you want to delete these items?',
content: 'When clicked the OK button, this dialog will be closed after 1 second', content: 'When clicked the OK button, this dialog will be closed after 1 second',
onOk() { onOk() {

View File

@ -21,12 +21,10 @@ To use `confirm()` to popup a confirmation modal dialog.
</div> </div>
</template> </template>
<script> <script>
import { Modal } from 'antd'
const confirm = Modal.confirm
export default { export default {
methods: { methods: {
showConfirm() { showConfirm() {
confirm({ this.$confirm({
title: 'Do you Want to delete these items?', title: 'Do you Want to delete these items?',
content: 'Some descriptions', content: 'Some descriptions',
onOk() { onOk() {
@ -40,7 +38,7 @@ export default {
}, },
showDeleteConfirm() { showDeleteConfirm() {
confirm({ this.$confirm({
title: 'Are you sure delete this task?', title: 'Are you sure delete this task?',
content: 'Some descriptions', content: 'Some descriptions',
okText: 'Yes', okText: 'Yes',

View File

@ -24,7 +24,7 @@ export default {
methods: { methods: {
info() { info() {
const h = this.$createElement const h = this.$createElement
Modal.info({ this.$info({
title: 'This is a notification message', title: 'This is a notification message',
content: h('div',{}, [ content: h('div',{}, [
h('p', 'some messages...some messages...'), h('p', 'some messages...some messages...'),
@ -35,7 +35,7 @@ export default {
}, },
success() { success() {
Modal.success({ this.$success({
title: 'This is a success message', title: 'This is a success message',
content: ( // JSX support content: ( // JSX support
<div> <div>
@ -47,14 +47,14 @@ export default {
}, },
error() { error() {
Modal.error({ this.$error({
title: 'This is an error message', title: 'This is an error message',
content: 'some messages...some messages...', content: 'some messages...some messages...',
}); });
}, },
warning() { warning() {
Modal.warning({ this.$warning({
title: 'This is a warning message', title: 'This is a warning message',
content: 'some messages...some messages...', content: 'some messages...some messages...',
}); });

View File

@ -30,8 +30,6 @@ To customize the text of the buttons, you need to set `okText` and `cancelText`
</div> </div>
</template> </template>
<script> <script>
import { Modal } from 'antd'
const confirm = Modal.confirm
export default { export default {
data() { data() {
return { return {
@ -46,7 +44,7 @@ export default {
this.visible = false this.visible = false
}, },
confirm() { confirm() {
confirm({ this.$confirm({
title: 'Confirm', title: 'Confirm',
content: 'Bla bla ...', content: 'Bla bla ...',
okText: '确认', okText: '确认',

View File

@ -14,11 +14,10 @@ Manually destroying a modal.
<a-button @click="success">Success</a-button> <a-button @click="success">Success</a-button>
</template> </template>
<script> <script>
import { Modal } from 'antd'
export default { export default {
methods: { methods: {
success() { success() {
const modal = Modal.success({ const modal = this.$success({
title: 'This is a notification message', title: 'This is a notification message',
content: 'This modal will be destroyed after 1 second', content: 'This modal will be destroyed after 1 second',
}); });

View File

@ -14,11 +14,10 @@ The simplest usage that close the notification box after 4.5s.
<a-button type="primary" @click="openNotification">Open the notification box</a-button> <a-button type="primary" @click="openNotification">Open the notification box</a-button>
</template> </template>
<script> <script>
import { notification } from 'antd'
export default { export default {
methods: { methods: {
openNotification () { openNotification () {
notification.open({ this.$notification.open({
message: 'Notification Title', message: 'Notification Title',
description: 'This is the content of the notification. This is the content of the notification. This is the content of the notification.', description: 'This is the content of the notification. This is the content of the notification. This is the content of the notification.',
}); });

View File

@ -14,11 +14,10 @@ The icon can be customized to any vue node or (h) => vue node.
<a-button type="primary" @click="openNotification">Open the notification box</a-button> <a-button type="primary" @click="openNotification">Open the notification box</a-button>
</template> </template>
<script> <script>
import { notification } from 'antd'
export default { export default {
methods: { methods: {
openNotification () { openNotification () {
notification.open({ this.$notification.open({
message: 'Notification Title', message: 'Notification Title',
description: 'This is the content of the notification. This is the content of the notification. This is the content of the notification.', description: 'This is the content of the notification. This is the content of the notification. This is the content of the notification.',
icon: <a-icon type="smile-circle" style="color: #108ee9" />, icon: <a-icon type="smile-circle" style="color: #108ee9" />,

View File

@ -14,11 +14,10 @@ The style and className are available to customize Notification.
<a-button type="primary" @click="openNotification">Open the notification box</a-button> <a-button type="primary" @click="openNotification">Open the notification box</a-button>
</template> </template>
<script> <script>
import { notification } from 'antd'
export default { export default {
methods: { methods: {
openNotification () { openNotification () {
notification.open({ this.$notification.open({
message: 'Notification Title', message: 'Notification Title',
description: 'This is the content of the notification. This is the content of the notification. This is the content of the notification.', description: 'This is the content of the notification. This is the content of the notification. This is the content of the notification.',
style: { style: {

View File

@ -16,11 +16,10 @@ the notification box will never close automatically.
<a-button type="primary" @click="openNotification">Open the notification box</a-button> <a-button type="primary" @click="openNotification">Open the notification box</a-button>
</template> </template>
<script> <script>
import { notification } from 'antd'
export default { export default {
methods: { methods: {
openNotification () { openNotification () {
notification.open({ this.$notification.open({
message: 'Notification Title', message: 'Notification Title',
description: 'I will never close automatically. I will be close automatically. I will never close automatically.', description: 'I will never close automatically. I will be close automatically. I will never close automatically.',
duration: 0, duration: 0,

View File

@ -19,7 +19,6 @@ A notification box can pop up from `topRight` or `bottomRight` or `bottomLeft` o
</div> </div>
</template> </template>
<script> <script>
import { notification } from 'antd'
const options = ['topLeft', 'topRight', 'bottomLeft', 'bottomRight']; const options = ['topLeft', 'topRight', 'bottomLeft', 'bottomRight'];
export default { export default {
data () { data () {
@ -30,14 +29,14 @@ A notification box can pop up from `topRight` or `bottomRight` or `bottomLeft` o
}, },
watch: { watch: {
selected(val) { selected(val) {
notification.config({ this.$notification.config({
placement: val, placement: val,
}); });
} }
}, },
methods: { methods: {
openNotification (val) { openNotification (val) {
notification.open({ this.$notification.open({
message: 'Notification Title', message: 'Notification Title',
description: 'This is the content of the notification. This is the content of the notification. This is the content of the notification.', description: 'This is the content of the notification. This is the content of the notification. This is the content of the notification.',
}); });

View File

@ -14,7 +14,6 @@ The simplest usage that close the notification box after 4.5s.
<a-button type="primary" @click="openNotification">Open the notification box</a-button> <a-button type="primary" @click="openNotification">Open the notification box</a-button>
</template> </template>
<script> <script>
import { notification } from 'antd'
const close = () => { const close = () => {
console.log('Notification was closed. Either the close button was clicked or duration time elapsed.'); console.log('Notification was closed. Either the close button was clicked or duration time elapsed.');
}; };
@ -22,7 +21,7 @@ The simplest usage that close the notification box after 4.5s.
methods: { methods: {
openNotification () { openNotification () {
const key = `open${Date.now()}`; const key = `open${Date.now()}`;
notification.open({ this.$notification.open({
message: 'Notification Title', message: 'Notification Title',
description: 'A function will be be called after the notification is closed (automatically after the "duration" time of manually).', description: 'A function will be be called after the notification is closed (automatically after the "duration" time of manually).',
btn: (h)=>{ btn: (h)=>{
@ -32,7 +31,7 @@ The simplest usage that close the notification box after 4.5s.
size: 'small', size: 'small',
}, },
on: { on: {
click: () => notification.close(key) click: () => this.$notification.close(key)
} }
}, 'Confirm') }, 'Confirm')
}, },

View File

@ -19,11 +19,10 @@ A notification box with a icon at the left side.
</div> </div>
</template> </template>
<script> <script>
import { notification } from 'antd'
export default { export default {
methods: { methods: {
openNotificationWithIcon (type) { openNotificationWithIcon (type) {
notification[type]({ this.$notification[type]({
message: 'Notification Title', message: 'Notification Title',
description: 'This is the content of the notification. This is the content of the notification. This is the content of the notification.', description: 'This is the content of the notification. This is the content of the notification. This is the content of the notification.',
}); });

View File

@ -32,6 +32,7 @@ export const PaginationProps = () => ({
}) })
export default { export default {
name: 'APagination',
props: { props: {
...PaginationProps(), ...PaginationProps(),
prefixCls: PropTypes.string.def('ant-pagination'), prefixCls: PropTypes.string.def('ant-pagination'),

View File

@ -14,7 +14,7 @@ import defaultLocale from '../locale-provider/default'
const tooltipProps = abstractTooltipProps() const tooltipProps = abstractTooltipProps()
const btnProps = buttonTypes() const btnProps = buttonTypes()
export default { export default {
name: 'popconfirm', name: 'APopconfirm',
props: { props: {
...tooltipProps, ...tooltipProps,
prefixCls: PropTypes.string.def('ant-popover'), prefixCls: PropTypes.string.def('ant-popover'),

View File

@ -6,7 +6,7 @@ import { getOptionProps, getComponentFromProp } from '../_util/props-util'
const props = abstractTooltipProps() const props = abstractTooltipProps()
export default { export default {
name: 'popover', name: 'APopover',
props: { props: {
...props, ...props,
prefixCls: PropTypes.string.def('ant-popover'), prefixCls: PropTypes.string.def('ant-popover'),

View File

@ -31,7 +31,7 @@ export const ProgressProps = {
} }
export default { export default {
name: 'Progress', name: 'AProgress',
props: initDefaultProps(ProgressProps, { props: initDefaultProps(ProgressProps, {
type: 'line', type: 'line',
percent: 0, percent: 0,

View File

@ -1,7 +1,7 @@
import PropTypes from '../_util/vue-types' import PropTypes from '../_util/vue-types'
import Radio from './Radio' import Radio from './Radio'
export default { export default {
name: 'RadioGroup', name: 'ARadioGroup',
props: { props: {
prefixCls: { prefixCls: {
default: 'ant-radio-group', default: 'ant-radio-group',

View File

@ -1,7 +1,7 @@
import PropTypes from '../_util/vue-types' import PropTypes from '../_util/vue-types'
import hasProp from '../_util/props-util' import hasProp from '../_util/props-util'
export default { export default {
name: 'Radio', name: 'ARadio',
props: { props: {
prefixCls: { prefixCls: {
default: 'ant-radio', default: 'ant-radio',

View File

@ -3,6 +3,7 @@ import Group from './Group'
const Button = { const Button = {
extends: Radio, extends: Radio,
name: 'ARadioButton',
props: { props: {
...Radio.props, ...Radio.props,
prefixCls: { prefixCls: {

View File

@ -16,7 +16,7 @@ export const RateProps = {
} }
export default { export default {
name: 'Rate', name: 'ARate',
model: { model: {
prop: 'value', prop: 'value',
event: 'change', event: 'change',

2
components/row/index.js Normal file
View File

@ -0,0 +1,2 @@
import { Row } from '../grid'
export default Row

View File

@ -0,0 +1,2 @@
import '../../style/index.less'
import '../../grid/style/index.less'

View File

@ -82,9 +82,9 @@ export {
} }
export default { export default {
Option, Option: { ...Option, name: 'ASelectOption' },
OptGroup, OptGroup: { ...OptGroup, name: 'ASelectOptGroup' },
name: 'Select', name: 'ASelect',
props: { props: {
...SelectProps, ...SelectProps,
prefixCls: PropTypes.string.def('ant-select'), prefixCls: PropTypes.string.def('ant-select'),

View File

@ -45,7 +45,7 @@ export const SliderProps = () => ({
}) })
export default { export default {
name: 'Slider', name: 'ASlider',
model: { model: {
prop: 'value', prop: 'value',
event: 'change', event: 'change',

View File

@ -15,7 +15,7 @@ export const SpinProps = () => ({
}) })
export default { export default {
name: 'Spin', name: 'ASpin',
mixins: [BaseMixin], mixins: [BaseMixin],
props: initDefaultProps(SpinProps(), { props: initDefaultProps(SpinProps(), {
prefixCls: 'ant-spin', prefixCls: 'ant-spin',

View File

@ -20,13 +20,13 @@ const getStepsProps = (defaultProps = {}) => {
} }
export default { export default {
name: 'Steps', name: 'ASteps',
props: getStepsProps({ props: getStepsProps({
prefixCls: 'ant-steps', prefixCls: 'ant-steps',
iconPrefix: 'ant', iconPrefix: 'ant',
current: 0, current: 0,
}), }),
Step: VcSteps.Step, Step: { ...VcSteps.Step, name: 'AStep' },
render () { render () {
const props = getOptionProps(this) const props = getOptionProps(this)
const stepsProps = { const stepsProps = {

View File

@ -4,7 +4,7 @@ import { getOptionProps, getComponentFromProp } from '../_util/props-util'
import VcSwitch from '../vc-switch' import VcSwitch from '../vc-switch'
export default { export default {
name: 'vSwitch', name: 'ASwitch',
model: { model: {
prop: 'checked', prop: 'checked',
event: 'change', event: 'change',

View File

@ -1,6 +1,6 @@
import { ColumnProps } from './interface' import { ColumnProps } from './interface'
export default { export default {
name: 'Column', name: 'ATableColumn',
props: ColumnProps, props: ColumnProps,
} }

View File

@ -2,7 +2,7 @@
import PropTypes from '../_util/vue-types' import PropTypes from '../_util/vue-types'
export default { export default {
name: 'ColumnGroup', name: 'ATableColumnGroup',
props: { props: {
title: PropTypes.any, title: PropTypes.any,
}, },

View File

@ -5,7 +5,7 @@ import { getOptionProps, getKey, getClass,
} from '../_util/props-util' } from '../_util/props-util'
const Table = { const Table = {
name: 'Table', name: 'ATable',
Column: T.Column, Column: T.Column,
ColumnGroup: T.ColumnGroup, ColumnGroup: T.ColumnGroup,
props: T.props, props: T.props,

View File

@ -1,6 +1,7 @@
import Tabs from './tabs' import Tabs from './tabs'
import TabPane from '../vc-tabs/src/TabPane' import TabPane from '../vc-tabs/src/TabPane'
import TabContent from '../vc-tabs/src/TabContent' import TabContent from '../vc-tabs/src/TabContent'
Tabs.TabPane = TabPane Tabs.TabPane = { ...TabPane, name: 'ATabPane' }
Tabs.TabContent = { ...TabContent, name: 'ATabContent' }
export default Tabs export default Tabs
export { TabPane, TabContent } export { TabPane, TabContent }

View File

@ -4,6 +4,7 @@ import isFlexSupported from '../_util/isFlexSupported'
import { hasProp, getComponentFromProp, getComponentName, isEmptyElement } from '../_util/props-util' import { hasProp, getComponentFromProp, getComponentName, isEmptyElement } from '../_util/props-util'
import warning from '../_util/warning' import warning from '../_util/warning'
export default { export default {
name: 'ATabs',
props: { props: {
prefixCls: { type: String, default: 'ant-tabs' }, prefixCls: { type: String, default: 'ant-tabs' },
activeKey: String, activeKey: String,
@ -112,7 +113,7 @@ export default {
if (isEmptyElement(child)) { return } if (isEmptyElement(child)) { return }
const { componentOptions } = child const { componentOptions } = child
const componentName = getComponentName(componentOptions) const componentName = getComponentName(componentOptions)
warning(componentName === 'TabPane', '`Tabs children just support TabPane') warning(componentName === 'ATabPane', '`Tabs children just support TabPane')
if (componentOptions && componentName === 'TabPane') { if (componentOptions && componentName === 'TabPane') {
componentOptions.propsData = componentOptions.propsData || {} componentOptions.propsData = componentOptions.propsData || {}
if (componentOptions.propsData.tab === undefined) { if (componentOptions.propsData.tab === undefined) {

View File

@ -1,6 +1,6 @@
export default { export default {
name: 'CheckableTag', name: 'ACheckableTag',
model: { model: {
prop: 'checked', prop: 'checked',
}, },

View File

@ -4,7 +4,7 @@ import getTransitionProps from '../_util/getTransitionProps'
import omit from 'omit.js' import omit from 'omit.js'
export default { export default {
name: 'Tag', name: 'ATag',
props: { props: {
prefixCls: { prefixCls: {
default: 'ant-tag', default: 'ant-tag',

View File

@ -58,6 +58,7 @@ export const TimePickerProps = () => ({
}) })
export default { export default {
name: 'ATimePicker',
mixins: [BaseMixin], mixins: [BaseMixin],
props: initDefaultProps(TimePickerProps(), { props: initDefaultProps(TimePickerProps(), {
prefixCls: 'ant-time-picker', prefixCls: 'ant-time-picker',

View File

@ -13,7 +13,7 @@ export const TimelineProps = {
} }
export default { export default {
name: 'Timeline', name: 'ATimeline',
props: initDefaultProps(TimelineProps, { props: initDefaultProps(TimelineProps, {
prefixCls: 'ant-timeline', prefixCls: 'ant-timeline',
}), }),

View File

@ -11,7 +11,7 @@ export const TimeLineItemProps = {
} }
export default { export default {
name: 'TimelineItem', name: 'ATimelineItem',
props: initDefaultProps(TimeLineItemProps, { props: initDefaultProps(TimeLineItemProps, {
prefixCls: 'ant-timeline', prefixCls: 'ant-timeline',
color: 'blue', color: 'blue',

View File

@ -19,7 +19,7 @@ const splitObject = (obj, keys) => {
} }
const props = abstractTooltipProps() const props = abstractTooltipProps()
export default { export default {
name: 'Tooltip', name: 'ATooltip',
props: { props: {
...props, ...props,
title: PropTypes.any, title: PropTypes.any,

View File

@ -94,7 +94,6 @@ The ToolTip has 12 placements choice.
</div> </div>
</template> </template>
<script> <script>
import { message } from 'antd'
export default { export default {
data () { data () {

View File

@ -49,7 +49,7 @@ export const TransferLocale = {
} }
export default { export default {
name: 'Transfer', name: 'ATransfer',
mixins: [BaseMixin], mixins: [BaseMixin],
props: initDefaultProps(TransferProps, { props: initDefaultProps(TransferProps, {
dataSource: [], dataSource: [],

View File

@ -135,7 +135,7 @@ export default {
renderCommonMenuItem (child, i, subIndex, extraProps) { renderCommonMenuItem (child, i, subIndex, extraProps) {
if (child.tag === undefined) { return child } if (child.tag === undefined) { return child }
warning(['MenuItem', 'MenuItemGroup', 'SubMenu', 'MenuDivider'].includes(getComponentName(child.componentOptions)), warning(['MenuItem', 'MenuItemGroup', 'SubMenu', 'MenuDivider', 'AMenuItem', 'AMenuItemGroup', 'ASubMenu', 'AMenuDivider'].includes(getComponentName(child.componentOptions)),
`Menu children not support ${getComponentName(child.componentOptions)}`, `Menu children not support ${getComponentName(child.componentOptions)}`,
) )
const state = this.$data const state = this.$data

144
site/components.js Normal file
View File

@ -0,0 +1,144 @@
import Vue from 'vue'
import {
Affix,
// Anchor,
AutoComplete,
Alert,
Avatar,
BackTop,
Badge,
Breadcrumb,
Button,
Calendar,
Card,
Collapse,
// Carousel,
Cascader,
Checkbox,
Col,
DatePicker,
Divider,
Dropdown,
// Form,
Icon,
Input,
InputNumber,
// Layout,
// List,
LocaleProvider,
message,
Menu,
Modal,
notification,
Pagination,
Popconfirm,
Popover,
Progress,
Radio,
Rate,
Row,
Select,
Slider,
Spin,
Steps,
Switch,
Table,
Transfer,
// Tree,
// TreeSelect,
Tabs,
Tag,
TimePicker,
Timeline,
Tooltip,
// Mention,
// Upload,
// version,
} from 'antd'
Vue.component(Affix.name, Affix) // a-affix
Vue.component(AutoComplete.name, AutoComplete)
Vue.component(Alert.name, Alert)
Vue.component(Avatar.name, Avatar)
Vue.component(BackTop.name, BackTop)
Vue.component(Badge.name, Badge)
Vue.component(Breadcrumb.name, Breadcrumb)
Vue.component(Breadcrumb.Item.name, Breadcrumb.Item)
Vue.component(Button.name, Button)
Vue.component(Button.Group.name, Button.Group)
Vue.component(Calendar.name, Calendar)
Vue.component(Card.name, Card)
Vue.component(Card.Meta.name, Card.Meta)
Vue.component(Card.Grid.name, Card.Grid)
Vue.component(Collapse.name, Collapse)
Vue.component(Collapse.Panel.name, Collapse.Panel)
// Vue.component(Carousel.name, Carousel)
Vue.component(Cascader.name, Cascader)
Vue.component(Checkbox.name, Checkbox)
Vue.component(Checkbox.Group.name, Checkbox.Group)
Vue.component(Col.name, Col)
Vue.component(DatePicker.name, DatePicker)
Vue.component(DatePicker.MonthPicker.name, DatePicker.MonthPicker)
Vue.component(DatePicker.RangePicker.name, DatePicker.RangePicker)
Vue.component(DatePicker.WeekPicker.name, DatePicker.WeekPicker)
Vue.component(Divider.name, Divider)
Vue.component(Dropdown.name, Dropdown)
Vue.component(Dropdown.Button.name, Dropdown.Button)
// Vue.component(Form.name, Form)
Vue.component(Icon.name, Icon)
Vue.component(Input.name, Input)
Vue.component(Input.Group.name, Input.Group)
Vue.component(Input.Search.name, Input.Search)
Vue.component(Input.TextArea.name, Input.TextArea)
Vue.component(InputNumber.name, InputNumber)
// Vue.component(Layout.name, Layout)
// Vue.component(List.name, List)
Vue.component(LocaleProvider.name, LocaleProvider)
Vue.component(Menu.name, Menu)
Vue.component(Menu.Item.name, Menu.Item)
Vue.component(Menu.SubMenu.name, Menu.SubMenu)
Vue.component(Menu.Divider.name, Menu.Divider)
Vue.component(Menu.ItemGroup.name, Menu.ItemGroup)
Vue.component(Modal.name, Modal)
Vue.component(Pagination.name, Pagination)
Vue.component(Popconfirm.name, Popconfirm)
Vue.component(Popover.name, Popover)
Vue.component(Progress.name, Progress)
Vue.component(Radio.name, Radio)
Vue.component(Radio.Group.name, Radio.Group)
Vue.component(Radio.Button.name, Radio.Button)
Vue.component(Rate.name, Rate)
Vue.component(Row.name, Row)
Vue.component(Select.name, Select)
Vue.component(Select.Option.name, Select.Option)
Vue.component(Select.OptGroup.name, Select.OptGroup)
Vue.component(Slider.name, Slider)
Vue.component(Spin.name, Spin)
Vue.component(Steps.name, Steps)
Vue.component(Steps.Step.name, Steps.Step)
Vue.component(Switch.name, Switch)
Vue.component(Table.name, Table)
Vue.component(Table.Column.name, Table.Column)
Vue.component(Table.ColumnGroup.name, Table.ColumnGroup)
Vue.component(Transfer.name, Transfer)
// Vue.component(Tree.name, Tree)
// Vue.component(TreeSelect.name, TreeSelect)
Vue.component(Tabs.name, Tabs)
Vue.component(Tabs.TabPane.name, Tabs.TabPane)
Vue.component(Tag.name, Tag)
Vue.component(Tag.CheckableTag.name, Tag.CheckableTag)
Vue.component(TimePicker.name, TimePicker)
Vue.component(Timeline.name, Timeline)
Vue.component(Timeline.Item.name, Timeline.Item)
Vue.component(Tooltip.name, Tooltip)
// Vue.component(Mention.name, Mention)
// Vue.component(Upload.name, Upload)
Vue.prototype.$message = message
Vue.prototype.$notification = notification
Vue.prototype.$info = Modal.info
Vue.prototype.$success = Modal.success
Vue.prototype.$error = Modal.error
Vue.prototype.$warning = Modal.warning
Vue.prototype.$confirm = Modal.confirm

View File

@ -25,7 +25,7 @@ export default {
<a-row> <a-row>
<a-col xxl={4} xl={5} lg={5} md={6} sm={24} xs={24}> <a-col xxl={4} xl={5} lg={5} md={6} sm={24} xs={24}>
<router-link to={{ path: '/ant-design' }} id='logo'> <router-link to={{ path: '/ant-design' }} id='logo'>
<img alt='logo' src='https://raw.githubusercontent.com/vueComponent/ant-design/master/logo.png' /> <img alt='logo' style="height: 32px" src='https://raw.githubusercontent.com/vueComponent/ant-design/master/logo.png' />
<span> VUE-ANTD</span> <span> VUE-ANTD</span>
</router-link> </router-link>
</a-col> </a-col>

View File

@ -7,7 +7,7 @@ import VueClipboard from 'vue-clipboard2'
import routes from './routes' import routes from './routes'
import Md from './components/md' import Md from './components/md'
import Api from './components/api' import Api from './components/api'
import * as Components from '../components/index' import './components'
import demoBox from './components/demoBox' import demoBox from './components/demoBox'
Vue.use(VueClipboard) Vue.use(VueClipboard)
@ -15,16 +15,6 @@ Vue.use(VueRouter)
Vue.component(Md.name, Md) Vue.component(Md.name, Md)
Vue.component(Api.name, Api) Vue.component(Api.name, Api)
Vue.component('demo-box', demoBox) Vue.component('demo-box', demoBox)
Object.keys(Components).forEach(k => {
if (k === 'api') {
Object.keys(Components[k]).forEach(api => {
Vue.prototype[`$${api}`] = Components[k][api]
})
} else {
const name = `a${k.replace(/([A-Z])/g, '-$1').toLowerCase()}`
Vue.component(name, Components[k])
}
})
const router = new VueRouter({ const router = new VueRouter({
mode: 'history', mode: 'history',

View File

@ -197,6 +197,7 @@ module.exports = {
alias: { alias: {
'vue$': 'vue/dist/vue.esm.js', 'vue$': 'vue/dist/vue.esm.js',
'antd': path.join(__dirname, 'components'), 'antd': path.join(__dirname, 'components'),
'vue-antd-ui': path.join(__dirname, 'components'),
'@': path.join(__dirname, ''), '@': path.join(__dirname, ''),
}, },
}, },