亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - Why does react need the key attribute to identify elements, but vue does not?
三叔
三叔 2017-06-26 10:55:21
0
3
924

Why does react need the key attribute to identify elements, but vue does not? Which method does vue use to identify elements?

<ul>
  <li key="2015">Duke</li>
  <li key="2016">Villanova</li>
</ul>

<ul>
  <li key="2014">Connecticut</li>
  <li key="2015">Duke</li>
  <li key="2016">Villanova</li>
</ul>
三叔
三叔

reply all(3)
阿神

Who said vue has no key.

Whether it is vue or react, the key plays the same role. React does not need it, it just reports a warning.

大家講道理

Vue also needs it, the official website reads: In order to give Vue a hint so that it can track the identity of each node and thus reuse and reorder existing elements, you need to provide a unique key attribute for each item. The ideal key value is that each item has a unique id. Link the key in vue

洪濤

Each corresponding unique key, so that react can know which key data you are operating on later, and you can update only this one

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template