multiple bindings in forEach
See original GitHub issue在使用forEach时,如果有多个元素做forEach,如 在layer里画若干个点
layer.forEach(function(g) {
g.on('click', function(e) {
console.log('test')
}).
});
预期的结果应该是layer里的每一个点都被绑定了一个点击事件,点击一下打印test。 而在编写中发现有时会出现多重绑定的时间,比如layer里有三个对象,那forEach之后点击一下其中一个元素会打印三次。 并非每次都会出现这个问题,但是出现的次数不少
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
ios - @Binding and ForEach in SwiftUI - Stack Overflow
Indices create bugs. Swift and SwiftUI provide MULTIPLE other means for getting array members. Who gave this a green checkmark?! – ...
Read more >ForEach Breaks Data Binding | Apple Developer Forums
Using a ForEach loop breaks my data binding to an object in an array. I can create my view using the index of...
Read more >How to create a List or a ForEach from a binding
SwiftUI lets us create a List or ForEach directly from a binding, which then provides the content closure with individual bindings to each ......
Read more >The "foreach" binding - Knockout.js
The foreach binding duplicates a section of markup for each entry in an array, and binds each copy of that markup to the...
Read more >Bindable SwiftUI list elements - Swift by Sundell
Setting up two-way bindings between the elements in a collection and a series of SwiftUI views.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
我也暂时重现不了,尝试着玩没做版本管理回不去了,那就先关了吧再遇到了再说
重现了 👌 感谢发现一个新的bug, 很开心, 哈哈