VUE.js:父页面获取子组件的数据

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36069339/article/details/82500155

 compChart.vue为子组件,sdCompare.vue为父级页面。

1、在子组件中声明变量sericesArr

 2、在子组件用$emit()传值给父页面。

 3、在父页面中使用子组件<comp-chart></comp-chart>的地方,使用@方法名="子组件方法名"

 4、在父页面的method里定义方法childValue(ev)ev就是子组件传递的值

猜你喜欢

转载自blog.csdn.net/qq_36069339/article/details/82500155