多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] ### 2.组件传值 #### 父向子传 ``` 1.传值 <list-item v-for="(item, index) of list" :key="index" :content="item" :index="index" @delete="handleDelete" ></list-item> ``` ``` 2.接值 props: { index:Number, content:String }, ``` #### 子向父 ``` 1.传值 绑定事件: @click="handleClick" methods: { handleClick(){ this.$emit('delete',this.index) } }, ``` ``` 2.接值 绑定事件:@delete="handleDelete" handleDelete(index) { this.list.splice(index, 1); } ```