We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
多层嵌套,当外层循环和内层循环的
重名时,会导致
使用 megalo 写的v-for多层嵌套,当外层循环和内层循环的 :key 重名时,会导致 f_ 取到错误的值的情况,从而导致展示的数据有误。
v-for
:key
f_
出错的代码片段:
<view v-for="(item, index) in list" :key="index"> <view v-for="(goods, index) in item.list" :key="index"></view> </view>
上面的代码vue打包为h5是 ok的,但是打包为微信小程序则数据出错。 看了一下megalo的源码,
上面代码中,对比右左侧的 render 函数, 两个 index 都是外层循环的索引,�导致在运行时 getHid 方法中, 错误的计算了 f_ 值为 外层循环的index- 外层循环的index , 然后app内维护的数据就变成了
render
index
getHid
外层循环的index- 外层循环的index
{ $root: { 0: { h: { 3-0-0 3-1-1 3-2-2 3-3-3 } } } }
而期望的数据应该是:
$root: { 0: { h: { 3-0-0 3-0-1 3-0-2 3-0-3 …… } } } }
辛苦维护者 fix 一下
The text was updated successfully, but these errors were encountered:
No branches or pull requests
使用 megalo 写的
v-for
多层嵌套,当外层循环和内层循环的:key
重名时,会导致f_
取到错误的值的情况,从而导致展示的数据有误。出错的代码片段:
上面的代码vue打包为h5是 ok的,但是打包为微信小程序则数据出错。
看了一下megalo的源码,
上面代码中,对比右左侧的
render
函数, 两个index
都是外层循环的索引,�导致在运行时getHid
方法中, 错误的计算了f_
值为外层循环的index- 外层循环的index
, 然后app内维护的数据就变成了而期望的数据应该是:
辛苦维护者 fix 一下
The text was updated successfully, but these errors were encountered: