Skip to content

基础使用

按钮的默认宽、高 88rpx

vue
<hi-movable-button></hi-movable-button>

按钮文字

通过 text 设置按钮文字。

vue
<hi-movable-button text="主页"></hi-movable-button>

按钮位置

通过 position 设置按钮位置。可选的值有 left-top、left-center、left-bottom、right-top、right-center(默认)、right-bottom、center-top、center-center、center-bottom

vue
<hi-movable-button text="主页" position="left-center"></hi-movable-button>

Props

参数说明类型默认值可选值
hoverClass按钮的 hover-classStringhi-hover-
iconName图标名称String__zhuye-
text按钮文字String--
scaleArea当里面的 movable-view 设置为支持双指缩放时,设置此值可将缩放手势生效区域修改为整个 movable-areaBooleanfalse-
position位置Stringright-centerleft-topleft-centerleft-bottomright-topright-centerright-bottomcenter-topcenter-centercenter-bottom
directionmovable-view 的移动方向,Stringall属性值有 allverticalhorizontal``、none
inertiamovable-view 是否带有惯性Booleanfalse-
outOfBounds超过可移动区域后,movable-view 是否还可以移动Booleanfalse-
damping阻尼系数,用于控制 xy 改变时的动画和过界回弹的动画,值越大移动越快Number20-
friction摩擦系数,用于控制惯性滑动的动画,值越大摩擦力越大,滑动越快停止;必须大于 0,否则会被设置成默认值Number2-
disabled是否禁用Booleanfalse-
scale是否支持双指缩放,默认缩放手势生效区域是在 movable-viewBooleanfalse-
scaleMin定义缩放倍数最小值Number小程序 1.0,其他 0.5-
scaleMax定义缩放倍数最大值Number小程序 1.0,其他 3-
scaleValue定义缩放倍数,支持小数Number1-
animation是否使用动画Booleantrue-

Events

事件名说明回调参数
@click点击时触发-
@change拖动过程中触发的事件event.detail = {x: x, y: y, source: source},其中source表示产生移动的原因,值可为touch(拖动)、touch-out-of-bounds(超出移动范围)、out-of-bounds(超出移动范围后的回弹)、friction(惯性)和空字符串(setData)
@scale缩放过程中触发的事件event.detail = {x: x, y: y, scale: scale}

Slots

名称说明
#default内容插槽
#other插入其他内容的插槽