Skip to content

GestureView 手势视图

能够监听手势的view组件。

基本使用

html
<be-gesture-view
  class="gesture-area"
  preventScroll
  @slideLeft="slideLeft"
  @slideRight="slideRight"
  @slideTop="slideTop"
  @slideBottom="slideBottom"
>
  {{ tip }}
</be-gesture-view>
ts
import { ref } from 'vue';

const tip = ref('请滑动');

const slideLeft = () => {
  tip.value = '你向左滑动了';
};

const slideRight = () => {
  tip.value = '你向右滑动了';
};

const slideTop = () => {
  tip.value = '你向上滑动了';
};

const slideBottom = () => {
  tip.value = '你向下滑动了';
};
scss
.gesture-area {
  width: 100%;
  height: 300px;
  display: flex;
  justify-content: center;
  align-items: center;
}

API

Props

属性名说明类型默认值
rootClass根节点 classstring-
rootStyle根节点 stylestring-
triggerLevel滑动多少距离(px)触发手势number50
preventScroll阻止页面滚动booleanfalse

Events

事件名称说明回调参数
slideLeft向左滑动-
slideRight向右滑动-
slideTop向上滑动,当preventScroll=true时生效-
slideBottom向下滑动,当preventScroll=true时生效-

Slots

插槽名说明slot props默认值
default视图内容-