HarmonyOS swiper嵌套chart,当chart可以左右拖动的时候,会触发swiper的左右滚动

HarmonyOS
2024-12-18 15:46:37
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
Excelsior_abit

PanGesture参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-basic-gestures-pangesture-V5

简单示例代码如下:

import web_webview from '@ohos.web.webview'

@Entry
@Component
struct TestSwiperPage {
  private swiperController: SwiperController = new SwiperController()
  controller: web_webview.WebviewController = new web_webview.WebviewController()
  private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Left | PanDirection.Right })

  build() {
    Column() {
      Swiper(this.swiperController) {
        Text('前')
          .width('90%')
          .height('90%')
          .textAlign(TextAlign.Center)
          .fontSize(30)

        Scroll() {
          Column() {
            Web({ src: 'https://www.huawei.com/', controller: this.controller })
              .height(200)
              .width('100%')
              .backgroundColor('#11ff11')
              .gesture(
                PanGesture(this.panOption)
              )

            Column() {
              Text('此区域可正常操作').fontColor('#ffffff').fontSize('30vp').margin({top: 200})
            }.height(2000)
            .width('100%')
            .backgroundColor('#112311')
          }
        }
        .width('90%')
        .height('100%')

        Text('后')
          .width('90%')
          .height('90%')
          .textAlign(TextAlign.Center)
          .fontSize(30)
      }
      .interval(3000)
      .autoPlay(false)
      .height('100%')
    }
    .width('100%')
    .height('100%')
    .backgroundColor('#ff11ff')
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
分享
微博
QQ
微信
回复
2024-12-18 19:07:35
相关问题
HarmonyOS Chart图形
781浏览 • 1回复 待解决
Swiper 组件嵌套图片刷新数据闪烁
2267浏览 • 1回复 待解决
HarmonyOS Swiper嵌套RichEditor问题
581浏览 • 1回复 待解决
Tabs组件如何监听目前左右拖动距离
1090浏览 • 1回复 待解决
Chart内容如何清空。谢谢。
3690浏览 • 1回复 待解决
HarmonyOS Tabs和Web嵌套左右滑动问题
903浏览 • 1回复 待解决
HarmonyOS swiper组件滚动距离实时监听
996浏览 • 1回复 待解决
请问ets项目能调用jschart组件吗?
3532浏览 • 1回复 待解决
HarmonyOS swiper如何滚动到任意页面?
1113浏览 • 1回复 待解决