CubicBezier 贝塞尔曲线
CubicBezier 贝塞尔曲线,可用于加入购物车动画。
# 支持平台
| App(vue) | App(nvue) | H5 | 小程序 |
|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ |
# 左下方动画
通过 left 属性设置购物车(终点)中心位置left值,bottom 属性设置购物车(终点)中心位置bottom值,param 属性为自定义参数,@click 事件为点击目标元素开始执行动画。
<wui-list-cell :highlight="false">
<view class="wui-list__item">
<text class="wui-text">点击加号加入购物车</text>
<wui-cubic-bezier :left="left" :bottom="bottom" :param="0" @click="handleClick">
<wui-icon name="plussign"></wui-icon>
<template v-slot:badge>
<view class="wui-badge">1</view>
</template>
</wui-cubic-bezier>
</view>
</wui-list-cell>
//data数据
left: 116,
bottom: 140
# 右下方动画
通过 direction 属性设置动画方向, right 属性设置购物车(终点)中心位置right值,bottom 属性设置购物车(终点)中心位置bottom值,param 属性为自定义参数,@click 事件为点击目标元素开始执行动画。
<wui-list-cell :highlight="false">
<view class="wui-list__item">
<wui-cubic-bezier direction="rb" :right="right" :bottom="bottom" :param="0" @click="handleClick">
<wui-icon name="plussign"></wui-icon>
<template v-slot:badge>
<view class="wui-badge">1</view>
</template>
</wui-cubic-bezier>
<text class="wui-text">点击加号加入购物车</text>
</view>
</wui-list-cell>
//data数据
right: 100,
bottom: 140
# Slots
| 插槽名称 | 说明 |
|---|---|
| default | 目标(点击)元素 |
| badge | 动画元素 |
# Props
| 属性名 | 类型 | 说明 | 默认值 | 平台差异说明 |
|---|---|---|---|---|
| direction | String | 动画方向,可选值:rt(右上)、rb(右下)、lb(左下)、lt(左上) | lb | - |
| top | Number, String | 购物车(终点)中心位置top值,单位rpx,direction值为rt,lt时传值 | 100 | - |
| bottom | Number, String | 购物车(终点)中心位置bottom值,单位rpx,direction值为rb,lb时传值 | 100 | - |
| left | Number, String | 购物车(终点)中心位置left值,单位rpx,direction值为lb,lt时传值 | 60 | - |
| right | Number, String | 购物车(终点)中心位置right值,单位rpx,direction值为rt,rb时传值 | 60 | - |
| navbar | Boolean | 页面是否使用了原生导航栏,使用了自定义导航栏时传false | true | 仅nvue支持 |
| param | Number, String | 自定义参数 | 0 | - |
# Events
| 事件名 | 说明 | 回调参数 |
|---|---|---|
| @click | 点击目标(加号等)元素时触发 | { param:自定义参数 } |