多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
``` //子组件js this.$emit('delete',{}) ``` 实例: ``` //子组件 methods:{ handleClick(){ this.$emit('delete',this.index) } } ``` ``` //父组件 <div id="app"> <todo-item :content="item" :index="index" v-for="(item,index) of arr" @delete="handleDelete"></todo-item> </div> ``` > @delete="handleDelete"获取子组件delete中参数this.index ``` methods:{ handleDelete(index){ console.log(index) this.arr.splice(index,1); } } ```