BannerArc 横幅底部圆弧
V1.9.9+
概述
BannerArc 横幅底部圆弧,常用的布局组件。
# 支持平台
| App-vue | App-Nvue | 微信小程序 | 支付宝小程序 | 百度小程序 | 字节小程序 | QQ小程序 | H5 | PC | 快手小程序 | 钉钉小程序 |
|---|---|---|---|---|---|---|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
# 引入
以下介绍两种常用的引入方式。
第一种:在页面中引用、注册
import fuiBannerArc from "@/components/firstui/fui-banner-arc/fui-banner-arc.vue"
export default {
components:{
fuiBannerArc
}
}
1
2
3
4
5
6
2
3
4
5
6
第二种:easycom组件规范
传统vue组件,需要安装、引用、注册,三个步骤后才能使用组件。easycom将其精简为一步。
First UI easycom配置请查看 快速上手。
如果不了解easycom,可先查看 官网文档 (opens new window)。
# 代码演示
部分示例演示,完整使用请参考示例程序以及文档API。
纯背景色
通过 background 属性设置背景色。
<fui-banner-arc background="#465CFF"></fui-banner-arc>
1
渐变背景/调整高度/弧度
通过 background 属性设置背景色,height 属性设置高度,单位rpx,ratio 属性设置弧度大小。
<!-- ratio 用于调整弧度大小,值越大弧度越小 -->
<fui-banner-arc background="linear-gradient(#6831FF,#465CFF)" :height="500" :ratio="1.5"></fui-banner-arc>
1
2
2
图片设置弧度
通过 background 属性设置背景色,height 属性设置高度,ratio 属性设置弧度大小。
<fui-banner-arc background="#EDF9FF" height="512" :ratio="1.5">
<image class="fui-banner" src="https://res.firstui.cn/static/images/my/light/img_banner_3x.png" mode="widthFix"></image>
</fui-banner-arc>
1
2
3
2
3
.fui-banner {
/* #ifndef APP-NVUE */
width: 100%;
display: block;
/* #endif */
height: 512rpx;
/* #ifdef APP-NVUE */
/*nvue android 端外层容器设置圆角无法作用与内部图片*/
width: 750rpx;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 750rpx;
border-bottom-left-radius: 750rpx;
/* #endif */
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
TIP
nvue android 端外层容器设置圆角无法作用与内部图片,需要单独在图片上设置圆角,如上示例所示。
# Slots
| 插槽名称 | 说明 |
|---|---|
| default | 组件内部自定义显示内容 |
# Props
| 属性名 | 类型 | 说明 | 默认值 | 平台差异说明 |
|---|---|---|---|---|
| height | Number, String | 高度,单位rpx | 400 | - |
| ratio | Number, String | 圆弧view宽度与banner宽度比率,最小值 1.2,值越大弧度越小 | 1.2 | nvue端最小值1.5 |
| background | String | 背景色 | - | - |
| marginTop | Number, String | margin-top 值,单位rpx | 0 | - |
| marginBottom | Number, String | margin-bottom 值,单位rpx | 0 | - |
# Events
| 事件名 | 说明 | 回调参数 |
|---|---|---|
| @click | 点击banner圆弧时触发 | - |