fix(useDrag): 增加一个参数,可以设置在getProps方法返回的对象中不默认添加key属性 #1004
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
给useDrag增加一个参数,允许设置在getProps方法返回的对象中不默认添加key属性。
考虑以下useDrag不直接用于列表循环而被包装后使用的例子:
getProps(data) 返回的对象默认包含了一个由 data 序列化得到 key字符串, 当 data 改变时,key随之改变,此时旧的li节点会被直接替换成新的li节点,而children 也被重新 mount 而不是期望的 update
一个children被mount的例子