diff --git a/.gitignore b/.gitignore index c8978582836316fe31349d7b26e9a71b80889732..e0a60f3669a4019fffbc2e8d0ea7ccb93458d003 100755 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies -/node_modules +**/node_modules # roadhog-api-doc ignore /src/utils/request-temp.js _roadhog-api-doc diff --git a/src/components/Login/LoginItem.js b/src/components/Login/LoginItem.js index 2412ff017ec5dd60929abf305437ba09f930e030..05d9463831cb9fd5713945fb8f96165f613d444d 100644 --- a/src/components/Login/LoginItem.js +++ b/src/components/Login/LoginItem.js @@ -15,6 +15,10 @@ function generator({ defaultProps, defaultRules, type }) { updateActive: PropTypes.func, }; + static defaultProps = { + buttonText: '获取验证码', + }; + constructor(props) { super(props); this.state = { @@ -55,7 +59,7 @@ function generator({ defaultProps, defaultRules, type }) { const { getFieldDecorator } = form; const options = {}; let otherProps = {}; - const { onChange, defaultValue, rules, name, ...restProps } = this.props; + const { onChange, defaultValue, buttonText, rules, name, ...restProps } = this.props; const { count } = this.state; options.rules = rules || defaultRules; if (onChange) { @@ -82,7 +86,7 @@ function generator({ defaultProps, defaultRules, type }) { size="large" onClick={this.onGetCaptcha} > - {count ? `${count} s` : '获取验证码'} + {count ? `${count} s` : buttonText} diff --git a/src/components/Login/index.d.ts b/src/components/Login/index.d.ts index cd88a8b693d7f219221decc278329ffcbe4db60e..9c072867710ec785c44a525e260e3d844c5f1371 100644 --- a/src/components/Login/index.d.ts +++ b/src/components/Login/index.d.ts @@ -19,6 +19,7 @@ export interface LoginItemProps { style?: React.CSSProperties; onGetCaptcha?: () => void; placeholder?: string; + buttonText?: React.ReactNode; } export class LoginItem extends React.Component {} diff --git a/src/components/Login/index.en-US.md b/src/components/Login/index.en-US.md index bc38579fe68db8de84bc4a5bb2d9356d0004e38f..42b5b2199a72ccdfc95766a63f65cd0ea5f44738 100644 --- a/src/components/Login/index.en-US.md +++ b/src/components/Login/index.en-US.md @@ -39,6 +39,7 @@ Apart from the above properties, Login.Username also support all properties of a Property | Description | Type | Default ----|------|-----|------ onGetCaptcha | callback on getting a new Captcha | () => void | - +buttonText | text on getting a new Captcha | ReactNode | - Apart from the above properties, _Login.Captcha_ support the same properties with _Login.UserName_. diff --git a/src/components/Login/index.zh-CN.md b/src/components/Login/index.zh-CN.md index 98f0f624f0754f9798d69a6b05e10ea382cb6d93..2ae84cebbedca6872ec10ee09a4138df9cae9d09 100644 --- a/src/components/Login/index.zh-CN.md +++ b/src/components/Login/index.zh-CN.md @@ -40,6 +40,7 @@ rules | 校验规则,同 Form getFieldDecorator(id, options) 中 [option.rules 参数 | 说明 | 类型 | 默认值 ----|------|-----|------ onGetCaptcha | 点击获取校验码的回调 | () => void | - +buttonText | 点击获取校验码的说明文字 | ReactNode | - 除上述属性以外,Login.Captcha 支持的属性与 Login.UserName 相同。 diff --git a/src/components/PageHeader/index.js b/src/components/PageHeader/index.js index 59d56fc527cb15dcd7193f13ff1a81747283f678..7a602da0c0d4b8d7a546bf118c9f70ddffecd0bb 100644 --- a/src/components/PageHeader/index.js +++ b/src/components/PageHeader/index.js @@ -221,14 +221,16 @@ export default class PageHeader extends PureComponent { - {(tabList && tabList.length) ? ( + {tabList && tabList.length ? ( - {tabList.map(item => )} + {tabList.map(item => ( + + ))} ) : null}