按钮(aip-button)
可用于快速实现一个按钮,以及样式定义
示例
<aip-button width="375" height="48" btnStyle="background-color: red; border-radius: 50%;">
<div slot="left">Left</div>
<div>Button</div>
<div slot="right">Right</div>
</aip-button>
1
2
3
4
5
2
3
4
5
引入
<script
defer
src="https://unpkg.byted-static.com/latest/byted-fangyuan/aip-ui/dist/aip-button/aip-button.iife.js"
></script>
1
2
3
4
2
3
4
支持的属性
属性名称 | 默认值 | 必填 | 说明 |
---|---|---|---|
width | 0 | 是 | 按钮宽度。单位 px,会按 AIP 标准转化为 rem,编写时无需单独转化。 |
height | 0 | 是 | 按钮高度。细则如上。 |
content | - | 否 | 按钮文案内容。优先于默认 slot 展示 |
disabled | false | 否 | 是否禁用 |
btn-style | - | 否 | 按钮样式 |
btn-active-style | - | 否 | 按钮被点击时的激活样式 |
btn-disabled-style | - | 否 | 按钮被禁用的样式 |
text-style | - | 否 | 内容文本样式,仅当 content 有值时生效 |
text-active-style | - | 否 | 按钮被点击时的内容文本样式,仅当 content 有值时生效 |
text-disabled-style | - | 否 | 按钮被禁用时的内容文本样式,仅当 content 有值时生效 |
插槽(slot)
属性名称 | 默认值 | 必填 | 说明 |
---|---|---|---|
default | - | 否 | 默认 slot,如果有 content 则此 slot 被忽略,原生渲染不支持默认 slot,请使用 content 字段 |
left | - | 否 | |
right | - | 否 |