import { GestureControl } from '@ohos.gesture';
.onGesture((event: GestureEvent) => {
// 处理滑动手势
if (event.type === GestureType.Swipe && event.direction === SwipeDirection.Up) {
this.currentVideoIndex = (this.currentVideoIndex - 1 + this.videoListUrl.length) % this.videoListUrl.length;
} else if (event.type === GestureType.Swipe && event.direction === SwipeDirection.Down) {
this.currentVideoIndex = (this.currentVideoIndex + 1) % this.videoListUrl.length;
}
});
这样的引入报错,是这功能取消了嘛,还是什么,我是想做一个视频上下滑动的效果。
视频上下滑动可以使用Swiper和Video实现,其中视频文件在/resource/rawfile/video中,可以参考下以下demo