From bb9bd4b73f8ee670ff7fd352e64ee77ed68d8932 Mon Sep 17 00:00:00 2001 From: songchenglin3 <353833373@qq.com> Date: Fri, 27 Dec 2024 11:55:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20props=20type=E4=BF=AE=E6=94=B9=E4=B8=BAc?= =?UTF-8?q?olor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- migrate-from-v2.md | 2 +- src/packages/price/__test__/price.spec.tsx | 4 ++-- src/packages/price/demos/h5/demo8.tsx | 2 +- src/packages/price/demos/h5/demo9.tsx | 8 ++++---- src/packages/price/demos/taro/demo8.tsx | 2 +- src/packages/price/demos/taro/demo9.tsx | 8 ++++---- src/packages/price/doc.en-US.md | 2 +- src/packages/price/doc.md | 2 +- src/packages/price/doc.zh-TW.md | 2 +- src/packages/price/index.taro.ts | 2 +- src/packages/price/index.ts | 2 +- src/packages/price/price.taro.tsx | 8 ++++---- src/packages/price/price.tsx | 6 +++--- src/packages/price/types.ts | 4 ++-- 14 files changed, 27 insertions(+), 27 deletions(-) diff --git a/migrate-from-v2.md b/migrate-from-v2.md index 12b77156e..e4909bda2 100644 --- a/migrate-from-v2.md +++ b/migrate-from-v2.md @@ -734,7 +734,7 @@ plugins: [ #### Price - 修改 `size`,增加 'xlarge' 尺寸 -- 新增 `type`, 价格类型 +- 新增 `color`, 价格类型 #### Progress diff --git a/src/packages/price/__test__/price.spec.tsx b/src/packages/price/__test__/price.spec.tsx index 312e45d97..2eaed3259 100644 --- a/src/packages/price/__test__/price.spec.tsx +++ b/src/packages/price/__test__/price.spec.tsx @@ -47,7 +47,7 @@ test('props size', () => { ) }) -test('props type', () => { - const { container } = render() +test('props color', () => { + const { container } = render() expect(container.querySelector('.nut-price')).toHaveClass('nut-price-primary') }) diff --git a/src/packages/price/demos/h5/demo8.tsx b/src/packages/price/demos/h5/demo8.tsx index c3e1f9afb..73b8a3381 100644 --- a/src/packages/price/demos/h5/demo8.tsx +++ b/src/packages/price/demos/h5/demo8.tsx @@ -6,7 +6,7 @@ const Demo8 = () => {   - + ) } diff --git a/src/packages/price/demos/h5/demo9.tsx b/src/packages/price/demos/h5/demo9.tsx index 629fccd6e..c2e60a009 100644 --- a/src/packages/price/demos/h5/demo9.tsx +++ b/src/packages/price/demos/h5/demo9.tsx @@ -19,22 +19,22 @@ const Demo9 = () => { 专享价 - + 粉丝到手价 - + 秒杀价 - + 专享价 - + ) diff --git a/src/packages/price/demos/taro/demo8.tsx b/src/packages/price/demos/taro/demo8.tsx index e7e076971..212a776e4 100644 --- a/src/packages/price/demos/taro/demo8.tsx +++ b/src/packages/price/demos/taro/demo8.tsx @@ -7,7 +7,7 @@ const Demo8 = () => {   - + ) } diff --git a/src/packages/price/demos/taro/demo9.tsx b/src/packages/price/demos/taro/demo9.tsx index 50ebf2bea..cd7b102f3 100644 --- a/src/packages/price/demos/taro/demo9.tsx +++ b/src/packages/price/demos/taro/demo9.tsx @@ -23,22 +23,22 @@ const Demo9 = () => { 专享价 - + 粉丝到手价 - + 秒杀价 - + 专享价 - + ) diff --git a/src/packages/price/doc.en-US.md b/src/packages/price/doc.en-US.md index e8b1afecb..6efc166c4 100644 --- a/src/packages/price/doc.en-US.md +++ b/src/packages/price/doc.en-US.md @@ -88,7 +88,7 @@ import { Price } from '@nutui/nutui-react' | Property | Description | Type | Default | | --- | --- | --- | --- | -| type | Price type | `primary` \| `gray` \| `darkgray` | `primary` | +| color | Price type | `primary` \| `gray` \| `darkgray` | `primary` | | price | Price | `number` | `0` | | symbol | Symbol type | `string` | `¥` | | digits | Decimal digits | `number` | `2` | diff --git a/src/packages/price/doc.md b/src/packages/price/doc.md index 42bf9dbd4..f19ad0b34 100644 --- a/src/packages/price/doc.md +++ b/src/packages/price/doc.md @@ -88,7 +88,7 @@ import { Price } from '@nutui/nutui-react' | 属性 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | -| type | 价格类型 | `primary` \| `gray` \| `darkgray` | `primary` | +| color | 价格类型 | `primary` \| `gray` \| `darkgray` | `primary` | | price | 价格数量 | `number` | `0` | | symbol | 符号类型 | `string` | `¥` | | digits | 小数位位数 | `number` | `2` | diff --git a/src/packages/price/doc.zh-TW.md b/src/packages/price/doc.zh-TW.md index 5bd2cb863..6d27fe12a 100644 --- a/src/packages/price/doc.zh-TW.md +++ b/src/packages/price/doc.zh-TW.md @@ -88,7 +88,7 @@ import { Price } from '@nutui/nutui-react' | 屬性 | 說明 | 類型 | 默認值 | | --- | --- | --- | --- | -| type | 價格類型 | `primary` \| `gray` \| `darkgray` | `primary` | +| color | 價格類型 | `primary` \| `gray` \| `darkgray` | `primary` | | price | 價格數量 | `number` | `0` | | symbol | 符號類型 | `string` | `¥` | | digits | 小數位位數 | `number` | `2` | diff --git a/src/packages/price/index.taro.ts b/src/packages/price/index.taro.ts index 71e37a819..379abb8c0 100644 --- a/src/packages/price/index.taro.ts +++ b/src/packages/price/index.taro.ts @@ -1,4 +1,4 @@ import { Price } from './price.taro' -export type { PriceProps, PriceSize, PriceType } from './types' +export type { PriceProps, PriceSize, PriceColor } from './types' export default Price diff --git a/src/packages/price/index.ts b/src/packages/price/index.ts index 7aeeabd1a..3a4847c6d 100644 --- a/src/packages/price/index.ts +++ b/src/packages/price/index.ts @@ -1,4 +1,4 @@ import { Price } from './price' -export type { PriceProps, PriceSize, PriceType } from './types' +export type { PriceProps, PriceSize, PriceColor } from './types' export default Price diff --git a/src/packages/price/price.taro.tsx b/src/packages/price/price.taro.tsx index d6dc5e71f..3585c8378 100644 --- a/src/packages/price/price.taro.tsx +++ b/src/packages/price/price.taro.tsx @@ -8,7 +8,7 @@ import { harmony } from '@/utils/platform-taro' const defaultProps = { ...ComponentDefaults, - type: 'primary', + color: 'primary', price: 0, symbol: '¥', digits: 2, @@ -19,7 +19,7 @@ const defaultProps = { } as PriceProps export const Price: FunctionComponent> = (props) => { const { - type, + color, price, symbol, digits, @@ -142,14 +142,14 @@ export const Price: FunctionComponent> = (props) => { <> {harmony() ? ( {renderInner()} ) : ( {renderInner()} diff --git a/src/packages/price/price.tsx b/src/packages/price/price.tsx index a4c8e19a6..fbc68af7b 100644 --- a/src/packages/price/price.tsx +++ b/src/packages/price/price.tsx @@ -6,7 +6,7 @@ import { PriceProps } from './types' const defaultProps = { ...ComponentDefaults, - type: 'primary', + color: 'primary', price: 0, symbol: '¥', digits: 2, @@ -17,7 +17,7 @@ const defaultProps = { } as PriceProps export const Price: FunctionComponent> = (props) => { const { - type, + color, price, symbol, digits, @@ -93,7 +93,7 @@ export const Price: FunctionComponent> = (props) => { return (
diff --git a/src/packages/price/types.ts b/src/packages/price/types.ts index 1e86a6391..4d8eea1a7 100644 --- a/src/packages/price/types.ts +++ b/src/packages/price/types.ts @@ -1,9 +1,9 @@ import { BasicComponent } from '@/utils/typings' export type PriceSize = 'xlarge' | 'large' | 'normal' | 'small' -export type PriceType = 'primary' | 'gray' | 'darkgray' +export type PriceColor = 'primary' | 'gray' | 'darkgray' export interface PriceProps extends BasicComponent { - type: PriceType + color: PriceColor price: number | string symbol: string digits: number