# tui-cubic-bezier 贝塞尔曲线 会员组件
介绍
贝塞尔曲线,常用场景如添加购物车。
# 引入
# uni-app引入
第一种,手动引入(可全局引入)
import tuiCubicBezier from "@/components/thorui/tui-cubic-bezier/tui-cubic-bezier.vue"
export default {
components:{
tuiCubicBezier
}
}
第二种,开启easycom组件模式,如果不了解如何配置,可先查看 官网文档 (opens new window)。
# uni-app版本平台差异说明
App-Nvue | App-vue | H5 | 微信小程序 | 支付宝小程序 | 百度小程序 | 字节小程序 | QQ小程序 |
---|---|---|---|---|---|---|---|
升级中 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
# 微信小程序引入(可在app.json中全局引入)
{
"usingComponents": {
"tui-cubic-bezier": "/components/thorui/tui-cubic-bezier/tui-cubic-bezier"
}
}
# 代码演示
部分功能演示,具体可参考示例程序以及文档API。
动画方向
通过 direction
属性控制动画方向,up-右上(top,right),down-右下(right,bottom), bottom-左下(left,bottom),top-左上(left,top)。
其中括号中为属性 position
必传值,动画终点的位置点。
<!--uni-app-->
<tui-cubic-bezier
:windowWidth="windowWidth"
:windowHeight="windowHeight"
left="8rpx"
top="8rpx"
:position="{ left: 44, bottom: 54 }"
direction="bottom"
:index="index"
@click="addCart"
></tui-cubic-bezier>
<!--微信小程序-->
<tui-cubic-bezier
windowWidth="{{windowWidth}}"
windowHeight="{{windowHeight}}"
left="8rpx"
top="8rpx"
position="{{position}}"
direction="bottom"
index="{{index}}"
bindclick="addCart"
></tui-cubic-bezier>
# Slots
插槽名称 | 说明 |
---|---|
default | 标签显示内容,custom 属性设为为true时使用 |
# Props
属性名 | 类型 | 说明 | 默认值 |
---|---|---|---|
windowWidth | Number | 屏幕宽度[总宽度] px | 375 |
windowHeight | Number | 屏幕高度[总高度] px | 667 |
width | String | 动画显示内容宽度 | 40rpx |
height | String | 动画显示内容高度 | 40rpx |
backgroundColor | String | 动画显示内容背景颜色 | #EB0909 |
left | String | 动画显示内容left值 | 0 |
top | String | 动画显示内容top值 | 0 |
custom | Boolean | 是否自定义动画显示内容 | false |
direction | String | 动画方向,up-右上(top,right),down-右下(right,bottom), bottom-左下(left,bottom),top-左上(left,top) 其中括号中为属性 position 必传值,动画终点的位置点 | down |
position | Object | 根据方向传值,终点的位置点,一般为元素中心位置 | { top: 50,bottom: 80,left: 30,right: 40 } |
index | Number | 列表中索引 index | 0 |
params | [Number, String] | 自定义参数 | 0 |
# Events
注:uni-app端绑定事件使用@前缀,如@click;微信小程序原生使用bind前缀,如bindclick
事件名 | 说明 | 回调参数 |
---|---|---|
click | 点击动画显示内容时触发 | { index : index , params : params } |
# 预览
请以移动端效果为准,touch事件目前尚未完全在PC端做兼容。
# 特别说明
该组件为 会员组件
,非开源内容,需开通会员才可获取使用。
# 线上程序扫码预览
![]() | ![]() | ![]() |
---|---|---|
ThorUI组件库小程序码 | H5二维码 | ThorUI示例小程序码 |