1、ref加在普通元素上,使用this.ref.name获取到的是dom元素。
2、ref加在子组件上,用this.ref.name获取的是组件实例,可以使用组件的所有方法。
例:
<busIndustry ref="busIndustry"></busIndustry>
import busIndustry from './components/busIndustry'
components:{
busIndustry
}
mouted:{
this.search()
}
methods:{
search(){
this.$ref.busIndustry.pageByReportAndDate()//调用子组件里面的方法
}
}