From f95567ade758d453f4acad8a40d8ae717035476a Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Tue, 9 Nov 2021 14:23:35 +0800 Subject: [PATCH] types(SubmitBar): add SubmitBarTextAlign type --- packages/vant/src/submit-bar/README.md | 2 +- packages/vant/src/submit-bar/README.zh-CN.md | 2 +- packages/vant/src/submit-bar/SubmitBar.tsx | 11 ++++------- packages/vant/src/submit-bar/index.ts | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/vant/src/submit-bar/README.md b/packages/vant/src/submit-bar/README.md index 9bab937bf..8640ed713 100644 --- a/packages/vant/src/submit-bar/README.md +++ b/packages/vant/src/submit-bar/README.md @@ -127,7 +127,7 @@ export default { The component exports the following type definitions: ```ts -import type { SubmitBarProps } from 'vant'; +import type { SubmitBarProps, SubmitBarTextAlign } from 'vant'; ``` ## Theming diff --git a/packages/vant/src/submit-bar/README.zh-CN.md b/packages/vant/src/submit-bar/README.zh-CN.md index 6a7d6ad95..17b9e6273 100644 --- a/packages/vant/src/submit-bar/README.zh-CN.md +++ b/packages/vant/src/submit-bar/README.zh-CN.md @@ -134,7 +134,7 @@ export default { 组件导出以下类型定义: ```ts -import type { SubmitBarProps } from 'vant'; +import type { SubmitBarProps, SubmitBarTextAlign } from 'vant'; ``` ## 主题定制 diff --git a/packages/vant/src/submit-bar/SubmitBar.tsx b/packages/vant/src/submit-bar/SubmitBar.tsx index 50f8c7792..fc80bb467 100644 --- a/packages/vant/src/submit-bar/SubmitBar.tsx +++ b/packages/vant/src/submit-bar/SubmitBar.tsx @@ -1,9 +1,4 @@ -import { - PropType, - CSSProperties, - defineComponent, - ExtractPropTypes, -} from 'vue'; +import { PropType, defineComponent, ExtractPropTypes } from 'vue'; import { truthProp, makeStringProp, @@ -17,6 +12,8 @@ import { Button, ButtonType } from '../button'; const [name, bem, t] = createNamespace('submit-bar'); +export type SubmitBarTextAlign = 'left' | 'right'; + const submitBarProps = { tip: String, label: String, @@ -25,7 +22,7 @@ const submitBarProps = { loading: Boolean, currency: makeStringProp('¥'), disabled: Boolean, - textAlign: String as PropType, + textAlign: String as PropType, buttonText: String, buttonType: makeStringProp('danger'), buttonColor: String, diff --git a/packages/vant/src/submit-bar/index.ts b/packages/vant/src/submit-bar/index.ts index 246a29ab4..e0f5c3d49 100644 --- a/packages/vant/src/submit-bar/index.ts +++ b/packages/vant/src/submit-bar/index.ts @@ -3,4 +3,4 @@ import _SubmitBar from './SubmitBar'; export const SubmitBar = withInstall(_SubmitBar); export default SubmitBar; -export type { SubmitBarProps } from './SubmitBar'; +export type { SubmitBarProps, SubmitBarTextAlign } from './SubmitBar';