diff --git a/docs/markdown/v2-progress-tracking.md b/docs/markdown/v2-progress-tracking.md index 14bfa00da..023820c33 100644 --- a/docs/markdown/v2-progress-tracking.md +++ b/docs/markdown/v2-progress-tracking.md @@ -23,8 +23,11 @@ ### GoodsAction -- [ ] GoodsActionBigBtn 重命名为 GoodsActionButton -- [ ] GoodsActionMiniBtn 重命名为 GoodsActionIcon +- [x] GoodsActionBigBtn 重命名为 GoodsActionButton +- [x] GoodsActionMiniBtn 重命名为 GoodsActionIcon +- [x] GoodsActionBigBtn 移除 primary 属性,新增 type 属性 + +改动原因:规范命名,统一用法 ### Step diff --git a/packages/goods-action-button/index.tsx b/packages/goods-action-button/index.tsx index 4b198acf9..606f6154e 100644 --- a/packages/goods-action-button/index.tsx +++ b/packages/goods-action-button/index.tsx @@ -1,5 +1,5 @@ import { use } from '../utils'; -import Button, { ButtonEvents } from '../button'; +import Button, { ButtonType, ButtonEvents } from '../button'; import { emit, inherit } from '../utils/functional'; import { functionalRoute, routeProps, RouteProps } from '../utils/router'; @@ -9,6 +9,7 @@ import { DefaultSlots } from '../utils/use/sfc'; export type GoodsActionButtonProps = RouteProps & { text?: string; + type?: ButtonType; primary?: boolean; loading?: boolean; disabled?: boolean; @@ -32,9 +33,9 @@ function GoodsActionButton( square class={bem()} size="large" + type={props.type} loading={props.loading} disabled={props.disabled} - type={props.primary ? 'danger' : 'warning'} onClick={onClick} {...inherit(ctx)} > @@ -45,8 +46,8 @@ function GoodsActionButton( GoodsActionButton.props = { ...routeProps, + type: String, text: String, - primary: Boolean, loading: Boolean, disabled: Boolean }; diff --git a/packages/goods-action/demo/index.vue b/packages/goods-action/demo/index.vue index 3fe2c6d32..595d3dcdb 100644 --- a/packages/goods-action/demo/index.vue +++ b/packages/goods-action/demo/index.vue @@ -13,11 +13,12 @@ @click="onClickIcon" /> @@ -43,11 +44,12 @@ @click="onClickIcon" /> diff --git a/packages/goods-action/en-US.md b/packages/goods-action/en-US.md index 30e891cc5..fa4766b9c 100644 --- a/packages/goods-action/en-US.md +++ b/packages/goods-action/en-US.md @@ -30,11 +30,12 @@ Vue @click="onClickIcon" /> @@ -73,9 +74,12 @@ Use `info` prop to show messages in upper right corner of icon icon="shop-o" text="Icon3" /> - + @@ -104,6 +108,7 @@ Use `info` prop to show messages in upper right corner of icon | Attribute | Description | Type | Default | |------|------|------|------| +| type | Button type, Can be set to `primary` `info` `warning` `danger` | `String` | `default` | | text | Button text | `String` | - | | primary | Is primary button (red color) | `Boolean` | `false` | | disabled | Whether to disable button | `Boolean` | `false` | diff --git a/packages/goods-action/test/__snapshots__/index.spec.js.snap b/packages/goods-action/test/__snapshots__/index.spec.js.snap index c56f2e1f2..3071e8c4c 100644 --- a/packages/goods-action/test/__snapshots__/index.spec.js.snap +++ b/packages/goods-action/test/__snapshots__/index.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Button render default slot 1`] = ``; +exports[`Button render default slot 1`] = ``; exports[`Icon render default slot 1`] = `
diff --git a/packages/goods-action/zh-CN.md b/packages/goods-action/zh-CN.md index 1a86ecebb..014b888e0 100644 --- a/packages/goods-action/zh-CN.md +++ b/packages/goods-action/zh-CN.md @@ -30,11 +30,12 @@ Vue @click="onClickIcon" /> @@ -72,9 +73,12 @@ export default { icon="shop-o" text="店铺" /> - + @@ -105,7 +109,7 @@ export default { | 参数 | 说明 | 类型 | 默认值 | 版本 | |------|------|------|------|------| | text | 按钮文字 | `String` | - | - | -| primary | 是否为红色按钮 | `Boolean` | `false` | - | +| type | 按钮类型,可选值为 `primary` `info` `warning` `danger` | `String` | `default` | | disabled | 是否禁用按钮 | `Boolean` | `false` | - | 1.3.10 | | loading | 是否显示为加载状态 | `Boolean` | `false` | - | 1.3.10 | | url | 跳转链接 | `String` | - | - |