mirror of
https://github.com/youzan/vant.git
synced 2025-10-21 11:17:41 +00:00
feat(Button): add icon-prefix prop (#5666)
This commit is contained in:
@@ -106,6 +106,7 @@ Vue.use(Button);
|
||||
| text | Text | *string* | - |
|
||||
| color `v2.1.8` | Color, support linear-gradient | *string* | - |
|
||||
| icon | Left Icon | *string* | - |
|
||||
| icon-prefix `v2.5.3` | Icon className prefix | *string* | `van-icon` |
|
||||
| tag | HTML Tag | *string* | `button` |
|
||||
| native-type | Native Type Attribute | *string* | `''` |
|
||||
| plain | Whether to be plain button | *boolean* | `false` |
|
||||
|
@@ -128,8 +128,9 @@ Vue.use(Button);
|
||||
| text | 按钮文字 | *string* | - |
|
||||
| color `v2.1.8` | 按钮颜色,支持传入`linear-gradient`渐变色 | *string* | - |
|
||||
| icon | 左侧[图标名称](#/zh-CN/icon)或图片链接 | *string* | - |
|
||||
| tag | HTML 标签 | *string* | `button` |
|
||||
| native-type | 原生 button 标签 type 属性 | *string* | - |
|
||||
| icon-prefix `v2.5.3` | 图标类名前缀,同 Icon 组件的 [class-prefix 属性](#/zh-CN/icon#props) | *string* | `van-icon` |
|
||||
| tag | 根节点的 HTML 标签 | *string* | `button` |
|
||||
| native-type | 原生 button 标签的 type 属性 | *string* | - |
|
||||
| block | 是否为块级元素 | *boolean* | `false` |
|
||||
| plain | 是否为朴素按钮 | *boolean* | `false` |
|
||||
| square | 是否为方形按钮 | *boolean* | `false` |
|
||||
|
@@ -31,6 +31,7 @@ export type ButtonProps = RouteProps & {
|
||||
hairline?: boolean;
|
||||
disabled?: boolean;
|
||||
nativeType?: string;
|
||||
iconPrefix?: string;
|
||||
loadingSize: string;
|
||||
loadingType?: LoadingType;
|
||||
loadingText?: string;
|
||||
@@ -119,7 +120,9 @@ function Button(
|
||||
/>
|
||||
);
|
||||
} else if (icon) {
|
||||
content.push(<Icon name={icon} class={bem('icon')} />);
|
||||
content.push(
|
||||
<Icon name={icon} class={bem('icon')} classPrefix={props.iconPrefix} />
|
||||
);
|
||||
}
|
||||
|
||||
let text;
|
||||
|
Reference in New Issue
Block a user