Commit 189e6c5c authored by 陈帅's avatar 陈帅

Features: add buttonText on Login.Captcha

parent 11df3597
# 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
......
......@@ -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}
</Button>
</Col>
</Row>
......
......@@ -19,6 +19,7 @@ export interface LoginItemProps {
style?: React.CSSProperties;
onGetCaptcha?: () => void;
placeholder?: string;
buttonText?: React.ReactNode;
}
export class LoginItem extends React.Component<LoginItemProps, any> {}
......
......@@ -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_.
......
......@@ -40,6 +40,7 @@ rules | 校验规则,同 Form getFieldDecorator(id, options) 中 [option.rules
参数 | 说明 | 类型 | 默认值
----|------|-----|------
onGetCaptcha | 点击获取校验码的回调 | () => void | -
buttonText | 点击获取校验码的说明文字 | ReactNode | -
除上述属性以外,Login.Captcha 支持的属性与 Login.UserName 相同。
......
......@@ -221,14 +221,16 @@ export default class PageHeader extends PureComponent {
</div>
</div>
</div>
{(tabList && tabList.length) ? (
{tabList && tabList.length ? (
<Tabs
className={styles.tabs}
{...activeKeyProps}
onChange={this.onChange}
tabBarExtraContent={tabBarExtraContent}
>
{tabList.map(item => <TabPane tab={item.tab} key={item.key} />)}
{tabList.map(item => (
<TabPane tab={item.tab} key={item.key} />
))}
</Tabs>
) : null}
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment