vue父组件向子组件传递数据

1.父页面

<shorttable ref="variety" :cat-list="catList" :goods="goods" />
 
//引入字组件
import Shorttable from '@/views/permission/components/Shorttable'
//注册
components: { Shorttable },
 
//点击方法
 shortFilter() {
     this.$refs.variety.getvariety(this.variety, this.catList, this.goods) // 传递树种
 },
 
2.子组件
props: ['catList', 'goods'],
 
getvariety(variety, catList, goods) {
      this.variety = variety
      this.shortData = catList
      this.goods = goods
}
 

 

posted @ 2022-03-18 10:33  你猜我为啥秃头  阅读(59)  评论(0)    收藏  举报