前端Vue- v-for 循环中删除 元素;

出现原因: 在生成的页面数据中,删除其中一个;

解决方法: 页面中的数据是使用vue -》 v-for 绑定的;
使用的方法为

  methods: {
        dt(index, planDetail) {
	var a = confirm("确认删除此任务?");
	if(a == true){
	this.plan.splice(this.plan.indexOf(planDetail),1);
	  }	
         }
        }

其中,一定要确认plan 和 planDetail的数据是否正确;

posted @ 2020-06-15 13:12  习小习  阅读(4834)  评论(0)    收藏  举报