多层级的item时,wx:key如何取值?

小程序 文章 2020-08-17 16:41 617 0 全屏看文

AI助手支持GPT4.0

多层级的item时,wx:key如何取值?In the case of multi-level items, how does wx:key take the value?

多层级的item时,wx:key如何取值?

试过三种写法,都报了does not look like a valid key name.这个警告,在不用index做key和改变数据结构情况下,这里应该如何取值?

item.bean.id是存在并且不会重复的,在同一个view上我尝试过定义了data-id是有值的



Three writing methods have been tried, and they have all reported dos not look like a valid key name? item.bean.id It exists and will not be repeated. On the same view, I have tried to define that the data ID has a value

回答:

袁Z鹏:

你看看这个就晓得怎么写了

陈强:

定义一个wx:for-item就行了

Distance:

现在的key值直接是 wx:key="bean.id" 不需要 wx:key="{{item.bean.id}}"

-EOF-

AI助手支持GPT4.0