In learning problems vue2.0 when, on dealing with v-for discovery of key sequence:
< Body > <-! Normal cyclic -> <-! {NUM} {} -> <-! List loop -> < div ID = "itany" > < UL > <-! Name, value corresponds to the value name is displayed, but when the value name -> < Li V-for = "(name, value) in User" > {{value}} - {{name}} </ Li > </ ul > </ div > </ body > < Script > window.onload = function(){ new Vue({ el:'#itany', data:{ num:[12,14,25,67], user:{ id:'red', age:'32', class:'2', } } }); } </script> </html>
Whether with
<li v-for = "(value,name) in user">{{name}}-{{value}}</li>
还是说用
<li v-for = "(name,value) in user">{{value}}-{{name}}</li>
所输出的结果都是如下:
而使用
<li v-for = "(value,name) in user">{{value}}-{{name}}</li>
<li v-for = "(name,value) in user">{{name}}-{{value}}</li>
则会出现如下结果:
希望该博客对你有帮助!