vue 子组件获取父组件的方法
this.$emit("searchhide");
vue 子组件获取父组件的数据
父组件
<child :trust-plan-id-list="data"></child>
- 在子组件中声明并使用变量
在props 中声明,然后就可以直接使用啦
props:[
"trustPlanIdList"
],
获取父组件的方法:
this.$parent.methods
获取父组件的属性:
this.$parent.options
父组件获取子组件的方法
<search ref="search" v-show="!blurBgShow" @searchshow="rankshow=false" @searchhide="rankshow=true"></search>
获取子组件的属性:
this.$refs.search.searchShow