return a > b.id ? a:b.id はどういう意味なのでしょうか?特に?の意味がわかりません。
コード全体は、
var state = { count:0 } var app = new Vue({ el:'#app', data:{ name:'キマイラ', list:[ {id:1,name:'スライム',hp:100}, {id:2,name:'ゴブリン',hp:200}, {id:3,name:'ドラゴン',hp:500} ] }, methods:{ doAdd:function(){ var max = this.list.reduce(function(a,b){ return a > b.id ? a:b.id #ここの行 },0) this.list.push({ id:max+1, name:this.name, hp:500 }) }, doRemove:function(index){ this.list.splice(index,1) } } })
の様になっています。
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。