Vue中,子组件和父组件之间,值的改变或者传递,和方法调用
1.子组件改变父组件的值
<father label="云盘快照" name="name2"> <son :props='rows' @change="changestate"> </son> </father > 父组件method中 changestate(e){ this.operation = e; } 子组件method中 this.$emit( 'change',传的值this.data.xxx);1.1.父组件改子组件的值
SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。projectOpera()父组件方法{ this.$refs.child.operationList (子组件中的值)= true; }
2.父传子
父:components: {'b-div': b} // 注册,只能在当前a组件里使用 <b-div :propsname='datas(向子组件传递的参数)'></b-div>
子:<template> <div>{{propsname}}</div> </template>
export default{ props: ['propsname'],
data(){} }

更多精彩