feat(Button): add icon slot (#8784)

This commit is contained in:
neverland 2021-05-30 20:56:48 +08:00 committed by GitHub
parent 55cb436188
commit e97f5cea71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View File

@ -139,6 +139,7 @@ Vue.use(Button);
| Name | Description |
| ----------------- | ------------------- |
| default | Default slot |
| icon `v2.12.21` | Custom icon |
| loading `v2.10.1` | Custom loading icon |
### Less Variables

View File

@ -166,6 +166,7 @@ Vue.use(Button);
| 名称 | 说明 |
| ----------------- | -------------- |
| default | 按钮内容 |
| icon `v2.12.21` | 自定义图标 |
| loading `v2.10.1` | 自定义加载图标 |
### 样式变量

View File

@ -43,6 +43,7 @@ export type ButtonEvents = {
};
export type ButtonSlots = DefaultSlots & {
icon?: ScopedSlot;
loading?: ScopedSlot;
};
@ -130,6 +131,10 @@ function Button(
);
}
if (slots.icon) {
return <div class={bem('icon')}>{slots.icon()}</div>;
}
if (icon) {
return (
<Icon name={icon} class={bem('icon')} classPrefix={props.iconPrefix} />