导航链接在整个列表上处于活动状态,而不仅仅是一个视图

发布于 2025-02-09 15:54:46 字数 738 浏览 2 评论 0原文

我有以下视图:

List { 
  VStack {
    InnerVStack { 
      ...
    }

    InnerVStack { 
      ...
      
      Cell()
       .background { 
         NavigationLink()
      }

      ...
    }
  }
}

问题是,每当敲击整个vstack时,navigationLink就会激活。

我已经看到更多的人处理同样的问题,但确实无

济-EATE-element“> navigationLink内部列表中的ness insiral列表适用于hstack,而不是每个元素

列表,其中包含vStack的vStack可以使VSTACK TAPPABLE的整个区域而不仅仅是子视图

我想实现此类行为,只有当单元被轻拍时,navigationLink被激活,将用户重定向到另一个场景。

I have the following view:

List { 
  VStack {
    InnerVStack { 
      ...
    }

    InnerVStack { 
      ...
      
      Cell()
       .background { 
         NavigationLink()
      }

      ...
    }
  }
}

The problem is, that whenever the whole VStack is tapped, the NavigationLink is activated.

I have seen some more people deal with the same problem, but really to no avail:

NavigationLink inside List applies to HStack instead of each element

Lists that have a VStack containing a NavigationLink makes the whole area of the VStack tappable instead of only the SubView

I want to achieve such behavior, that only when Cell is tapped, then the NavigationLink is activated and user is redirected to another scene.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文