mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
feat(Button): add class-prefix prop to support custom icon (#3159)
This commit is contained in:
parent
dc7e3d2453
commit
d80ec54186
@ -120,6 +120,7 @@
|
|||||||
| size | 按钮尺寸,可选值为 `normal` `large` `small` `mini` | _string_ | `normal` | - |
|
| size | 按钮尺寸,可选值为 `normal` `large` `small` `mini` | _string_ | `normal` | - |
|
||||||
| color | 按钮颜色,支持传入`linear-gradient`渐变色 | _string_ | - | 1.0.0 |
|
| color | 按钮颜色,支持传入`linear-gradient`渐变色 | _string_ | - | 1.0.0 |
|
||||||
| icon | 左侧图标名称或图片链接,可选值见 [Icon 组件](#/icon) | _string_ | - | - |
|
| icon | 左侧图标名称或图片链接,可选值见 [Icon 组件](#/icon) | _string_ | - | - |
|
||||||
|
| class-prefix | 类名前缀 用法等同于[Icon 组件](#/icon) | _string_ | `van-icon` | - |
|
||||||
| plain | 是否为朴素按钮 | _boolean_ | `false` | - |
|
| plain | 是否为朴素按钮 | _boolean_ | `false` | - |
|
||||||
| block | 是否为块级元素 | _boolean_ | `false` | - |
|
| block | 是否为块级元素 | _boolean_ | `false` | - |
|
||||||
| round | 是否为圆形按钮 | _boolean_ | `false` | - |
|
| round | 是否为圆形按钮 | _boolean_ | `false` | - |
|
||||||
|
@ -13,6 +13,10 @@ VantComponent({
|
|||||||
|
|
||||||
props: {
|
props: {
|
||||||
icon: String,
|
icon: String,
|
||||||
|
classPrefix: {
|
||||||
|
type: String,
|
||||||
|
value: 'van-icon',
|
||||||
|
},
|
||||||
plain: Boolean,
|
plain: Boolean,
|
||||||
block: Boolean,
|
block: Boolean,
|
||||||
round: Boolean,
|
round: Boolean,
|
||||||
@ -73,7 +77,7 @@ VantComponent({
|
|||||||
this.$emit('click');
|
this.$emit('click');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
noop() {},
|
noop() {},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -31,10 +31,7 @@
|
|||||||
type="{{ loadingType }}"
|
type="{{ loadingType }}"
|
||||||
color="{{ loadingColor(type,color,plain) }}"
|
color="{{ loadingColor(type,color,plain) }}"
|
||||||
/>
|
/>
|
||||||
<view
|
<view wx:if="{{ loadingText }}" class="van-button__loading-text">
|
||||||
wx:if="{{ loadingText }}"
|
|
||||||
class="van-button__loading-text"
|
|
||||||
>
|
|
||||||
{{ loadingText }}
|
{{ loadingText }}
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
@ -43,6 +40,7 @@
|
|||||||
wx:if="{{ icon }}"
|
wx:if="{{ icon }}"
|
||||||
size="1.2em"
|
size="1.2em"
|
||||||
name="{{ icon }}"
|
name="{{ icon }}"
|
||||||
|
class-prefix="{{classPrefix}}"
|
||||||
class="van-button__icon"
|
class="van-button__icon"
|
||||||
custom-style="line-height: inherit;"
|
custom-style="line-height: inherit;"
|
||||||
/>
|
/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user