Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在用 Eureka 做过滤器表单。所以有一个包含所有类别的列表,前面还有一个“全部”单元格。所以我的问题是,当我按“全部”时,如何立即取消选择所有其他单元格,以及如何在单击其他单元格时取消选择“全部”。
希望有更优雅的方式存在
首先从您的选项数组中删除“全部”选项
noValueDisplayText = "All" 的第二个设置值
然后将此代码放入 .onChange 回调中
.onChange{ row in if let values = row.value { if values.count > 1 && values.contains("All") { row.value?.remove("All") } else if values.count == 0 { row.value = ["All"] } } }