子组件
子组件通过$emit触发父组件中的自定义函数,第一个值为自定义函数名,后面的参数是向父组件传的值
<van-button @click="emitGetList" type="info">搜索</van-button> emitGetList(){
this.$emit('refreshList',this.cityValue,this.amount,this.requires); },
父组件
<searchChild @refreshList = 'getDate' ></searchChild> getDate(city,industry,Lstyle,amount,requires){
this.cityValue = city this.industry = industry this.Lstyle = Lstyle this.amount = amount this.requires = requires this.getList() },
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/233834.html原文链接:https://javaforall.net