splice删除数组最后一项时报错
<div class="content" :index='index'> <p>确定要删除品牌:{{tableList[index].name}} 吗</p> <button @click="del(index)">确定</button> <button @click='cancel'>取消</button> </div>
报错代码:
del:function(id){ this.tableList.splice(id,1) for(i=0;i<this.tableList.length;i++){ this.tableList[i].id = i+1 } this.show=false}
报错数组:
tableList:[ {id:1,name:'三只松鼠',timer:new Date()}, {id:2,name:'英菲尼迪',timer:new Date()}, {id:3,name:'杰克琼斯',timer:new Date()}, {id:4,name:'雷蛇',timer:new Date()}, {id:5,name:'积家',timer:new Date()}, {id:6,name:'英伟达',timer:new Date()}, {id:7,name:'菲亚特',timer:new Date()} ] 去掉content中p标签的name则正常运行
斯蒂芬大帝
梦里花落0921
相关分类